如何解决如何检测Firefox的窗口索引?
| 我正在尝试使用Applescript在桌面上获取窗口索引(位置)Firefox。 我到现在为止,但我不知道如何进行。有人可以给我指出一些示例代码或线索。 :-|tell application \"System Events\"
set programs to processes whose visible is true and name is \"firefox-bin\" or name is \"google chrome\" or name is \"safari\"
repeat with program in programs
tell window of application program
#XXX do something
end tell
end repeat
end tell
解决方法
您必须知道要识别的窗口的某些属性。在我的示例中,我假设您知道窗口的名称。
set windowName to \"some name\"
set windowIndex to missing value
tell application \"System Events\"
set programs to processes whose visible is true and name is \"firefox-bin\" or name is \"google chrome\" or name is \"safari\"
repeat with program in programs
tell program
set windowNames to name of windows
repeat with i from 1 to count of windowNames
if windowName is item i of windowNames then
set windowIndex to i
exit repeat
end if
end repeat
end tell
end repeat
end tell
return windowIndex
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。