AppleScript:如何在全屏模式下激活应用程序?

时间:2017-11-16 12:51:16

标签: applescript focus

我已经尝试了tell application Emacs to activate但是当emacs处于全屏模式并且重点关注桌面时(在emacs上设置工具栏)它不起作用。

1 个答案:

答案 0 :(得分:1)

如果您谈论Emacs For Mac OS X,那么 Dock 上应该显示 Emacs.app Dock Tile ,您可以将焦点设置为全屏显示,假设只有一次 Emacs.app 正在运行,并使用以下 AppleScript 代码

if application "Emacs" is running then
    tell application "System Events" to click UI element "Emacs" of list 1 of application process "Dock"
end if

点击 Dock Tile ,会转到全屏,然后您可以在脚本中运行其他代码进行交互的的Emacs 即可。显然,如果 Emacs 不在全屏视图中,这会使 Emacs 窗口向前移动与tell application "Emacs" to activate相同。

相关问题