Applescript 以全屏模式打开应用程序?

Eri*_* Ho 6 macos shell applescript alfred

我正在尝试对 Alfred 进行编程,以使用工作流程打开我的终端、Sublime Text 和 Chrome。

我希望我的终端作为窗口正常打开,但我一直在尝试让 Chrome 和 Sublime 全屏打开。

我能够让 Chrome 在全屏模式下打开:

on alfred_script(q)
   tell application "Google Chrome"
        tell window 1 to enter presentation mode
   end tell
end alfred_script
Run Code Online (Sandbox Code Playgroud)

但是,这并没有转化为与我的 Sublime Text 一起使用。

我在这里缺少什么?

Geo*_* WS 5

假设您没有更改“进入全屏”的默认键盘快捷键,另一种方法是简单地让系统事件调用该快捷键 (??F)。与我见过的另一种方法一样(更改的值AXFullScreen- 请参阅此处 mklement0 的答案以详细讨论此方法),这需要使相关窗口处于活动状态。

例如,要在 Safari 中切换最前面窗口的全屏状态,请运行:

tell application "Safari" to activate
tell application "System Events"
        keystroke "f" using {command down, control down}
end tell
Run Code Online (Sandbox Code Playgroud)


iam*_*ber 4

如此处所示(我需要一个苹果脚本来全屏打开 Safari 并隐藏 Mavericks 上的工具栏)。该make new documentcan't get window 1通过打开一个新选项卡(如果之前未打开过)来防止错误。

tell application "Safari"

    make new document
    
    activate

    delay 3

    tell application "System Events" to tell process "Safari"

        set value of attribute "AXFullScreen" of window 1 to true

    end tell

end tell
Run Code Online (Sandbox Code Playgroud)