AppleScript-根据processName和windowTitle最小化所有窗口
我试图循环所有进程,并获取每个进程主窗口的windowTitle。根据windowTitle,我希望使进程隐藏() 我越来越AppleScript-根据processName和windowTitle最小化所有窗口,applescript,Applescript,我试图循环所有进程,并获取每个进程主窗口的windowTitle。根据windowTitle,我希望使进程隐藏() 我越来越 execution error: System Events got an error: Can’t get window 1 of item 1 of every process whose value of attribute "AXMain" = true. Invalid index. (-1719) 是不是因为所有进程都没有主窗口 是不是因
execution error: System Events got an error: Can’t get window 1 of item 1 of every process whose value of attribute "AXMain" = true. Invalid index. (-1719)
是不是因为所有进程都没有主窗口
是不是因为所有进程都没有主窗口
这与并非所有进程都有窗口(任何类型)有关
细分:
:将命令定向到系统事件。唯一的区别是我引用应用程序时使用了它的包标识符,而不是它的名称。这并不十分重要,但应用程序的捆绑包标识符与其文件名相比不太可能发生更改告诉应用程序id“com.apple.systemevents”到
:这是检索至少有一个窗口的进程列表的有效方法,因为它过滤掉了没有窗口的进程,其前窗口的告诉(其前窗口的class=window的每个进程
将类
缺少值
:将进程过滤到只包含窗口的应用程序,这将根据窗口的名称/标题对其进行进一步过滤。并且前窗口的标题不包含“foobar”
属性从title
,但访问属性是一个属性“AXTitle”获取其值
对象。在这里,我选择放松您在匹配窗口标题时施加的平等性,这样您就不需要使用窗口的完整标题,而需要使用您选择的一个合理的词属性
:隐藏先前返回的进程要将visible设置为true
告诉进程
到告诉进程
@vijay不,这是不正确的。进程
被分配了一个值,该值已经引用了进程
对象。
execution error: System Events got an error: Can’t get window 1 of item 1 of every process whose value of attribute "AXMain" = true. Invalid index. (-1719)
tell application id "com.apple.systemevents" to tell (every process ¬
whose front window's class = window and the front window's ¬
title does not contain "foobar") to set visible to true