我正在编写一个脚本,它将在 macOS 上的桌面上循环
我尝试使用快捷键“ctrl+right”和“ctrl+left”在桌面之间移动,我在计算机上设置了分别移动到右侧和左侧桌面。
# move 4 desktops to the right and back
tell application "System Events"
repeat 4 times
key code 124 using (control down)
key code 123 using (control down)
end repeat
end tell
一旦我进入具有全屏 RDP 会话的桌面,RDP 会话就会开始接收 ctrl+-> 而不是 macOS。
如何将焦点从 RDP 会话移回 macOS(或以不同的方式循环浏览桌面)?
我有这个切换到桌面 2 的 AppleScript :
tell application "Mission Control" to launch
tell application "System Events"
-- button 2 means desktop 2
click button 2 of list 1 of group 2 of group 1 of group 1 of process "Dock"
key code 53 -- # Esc key on US English Keyboard
end tell
我还没有找到这些群体的逻辑,我不确定你如何/是否可以调整它以满足你的要求。