Applescript 以全屏模式打开应用程序? [英] Applescript to open an application in full-screen mode?

查看:28
本文介绍了Applescript 以全屏模式打开应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试对 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆