提问人:Carl 提问时间:6/19/2010 更新时间:6/20/2010 访问量:894
通过 AppleScript 隐藏 Chromium 窗口
Hiding a Chromium window through AppleScript
问:
我认识到 Google Chrome 和 Chromium 还没有高度支持 AppleScript。但是,我想知道是否有办法使用“系统事件”来隐藏特定的窗口或选项卡?
这是我到目前为止所拥有的......
tell application "System Events"
tell process "Google Chrome"
repeat with theWindow in windows
set thePageName to title of theWindow
if thePageName contains "ABC" then
-- HIDE theWindow command here
end if
end repeat
end tell
结束告诉
我可以访问我希望隐藏的窗口,但找不到实际隐藏它的命令。
此外,如果有一种方法可以重复窗口中的选项卡,那就更好了。
谢谢
答:
1赞
regulus6633
6/20/2010
#1
系统事件可以为您键入键盘命令。因此,请查看应用程序的菜单项,看看是否有任何键盘快捷键可以执行您想要的操作。例如,每个应用程序都应该有一个“窗口”菜单。在“窗口”菜单中,有一个带有键盘快捷键“cmd-m”的“最小化”命令。因此,您可以使用该快捷方式来隐藏窗口。只需将“-- HIDE theWindow command here”替换为...
keystroke "m" using command down
还有一件事。为此,您必须在执行此操作之前确保应用程序位于最前面,因此将以下内容添加到脚本的开头。
tell application "Google Chrome" to activate
评论