我有一个问题。我需要循环浏览 Apple 的 Stickies 应用程序的窗口。我正在使用 Applescript。 但是,如果我有多个具有相同开头的音符,那么我只能得到第一个音符的属性。 (仍然循环查看真实的音符数)。
tell application "Stickies"
activate
tell application "System Events"
tell application process "Stickies"
set allWindows to every window
try
repeat with awindow in allWindows
set m to value of text area 1 of scroll area 1 of awindow
log m & "
"
end repeat
end try
end tell
end tell
end tell
上传示例图像时出错,因此将其作为脚本插入
<a href="https://ibb.co/hMJwC5Y"><img src="https://i.ibb.co/MhxQ9TB/zjo.webp" alt="zjo" border="0"></a>
如果您使用 ProcessID 进行迭代,您将获得唯一的引用并获得所有可用的窗口。
tell application "System Events"
set pidList to the unix id of (processes whose name contains "Stickies")
repeat with someID in pidList -- loop
log someID
tell (first process whose unix id is someID)
repeat with theWindow in windows
set m to value of text area 1 of scroll area 1 of theWindow
log m & "
"
end repeat
end tell
end repeat
end tell