使用 Automator 打开应用程序到特定桌面 - OSX

使用 Automator 打开应用程序到特定桌面 - OSX

我做一个现场广播节目,打开了很多应用程序(Traktor、Ableton、Nicecast、Caffene、RADR + 几个网页)。

有时我可能会有点着急,因此我在 OSX 中设置了一个 Automator 应用程序,以便让我尽快开始。

在演出期间,我利用桌面 1、2 和 3 来划分我的工作流程,并使用“Control + Arrow”在它们之间切换。Traktor 在桌面 1 上,Ableton/Nicecast 在桌面 2 上,而我的浏览器在桌面 3 上,等等。

我有两个问题......

  1. 有什么方法可以让我告诉 Automator 在特定的桌面上打开应用程序/网页?
  2. 我可以使用开关或设置打开一些应用程序来自动化应用程序状态吗?例如在打开时启用 Caffene。

答案1

您可以使用如下脚本:

delay 0.5 -- time to release modifier keys if for example the script is run with command-R
tell application "System Events" to key code 18 using control down -- number row 1
delay 1
tell application "TextEdit"
    reopen -- open a new default window if there are no open default windows
    activate -- make TextEdit frontmost
end tell
tell application "System Events" to key code 19 using control down -- number row 2
delay 1
tell application "Calculator"
    reopen
    activate
end tell

例如,必须在“系统偏好设置”>“键盘”>“键盘快捷键”>“任务控制”中将 control-2 分配给“切换到桌面 2”。

相关内容