Applescript to open an application in full-screen mode?

倾然丶 夕夏残阳落幕 提交于 2019-12-05 14:53:59
iammcgaber

As found here (i need an applescript to open safari in full screen an to hide the toolbar on mavericks)

tell application "Safari"

    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

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.

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!