我的一个应用程序进程偶尔会创建一个浮动窗口,我想以编程方式自动关闭该窗口。
我可以通过其名称检查该窗口是否存在,但随后我无法使用任何方法关闭它close window "windowname"
nor tell window "windowname" to close
.
E.g.:
tell application "System Events" to tell process "processname"
if exists window "windowname" then
close window "windowname"
end if
end tell
这导致:
错误“系统事件发生错误:进程“processname”的窗口“windowname”不理解“关闭”消息。”
那我怎样才能关闭这个窗口呢?
我可以像这样关闭 Finder 窗口。也许你也可以这样做。
tell application "System Events"
tell process "Finder"
click button 1 of window 1
end tell
end tell
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)