Applescript以全屏模式打开应用程序吗? [英] Applescript to open an application in full-screen mode?
问题描述
我正在尝试对Alfred进行编程,以使用工作流程打开终端","Sublime Text"和Chrome.
I'm trying to program Alfred to open my Terminal, Sublime Text, and Chrome with a workflow.
我希望我的终端正常作为窗口打开,但是我一直在尝试让Chrome和Sublime打开全屏.
I would like for my terminal to open normally as a window, but I've been trying to get Chrome and Sublime to open full screen.
我能够通过以下方式使Chrome以全屏模式打开:
I was able to get Chrome to open up in full screen mode with:
on alfred_script(q)
tell application "Google Chrome"
tell window 1 to enter presentation mode
end tell
end alfred_script
但是,这不能转换为适用于我的Sublime Text.
However, this did not translate to work with my Sublime Text.
我在这里想念什么?
推荐答案
另一种假设您尚未更改进入全屏"状态的默认键盘快捷方式的方法就是让系统事件调用该快捷方式(⌃⌘F ).与我看到的其他方法一样(更改AXFullScreen
的值-请参见 mklement0在这里的答案)对此方法进行了详尽的讨论),这需要激活相关窗口.
Another way to do this assuming you have not changed the default keyboard shortcut for "Enter Full Screen" is simply to have System Events invoke that shortcut (⌃⌘F). As with the other approach I've seen to doing this (changing the value of AXFullScreen
—see mklement0's answer here for a thorough discussion of this method), this requires making the relevant window active.
例如,要切换Safari中最前面的窗口的全屏状态,请运行:
For instance, to toggle the full-screen state of the frontmost window in Safari, run:
tell application "Safari" to activate
tell application "System Events"
keystroke "f" using {command down, control down}
end tell
这篇关于Applescript以全屏模式打开应用程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!