根据您对我的评论的回复,我将执行以下操作。请注意,我没有对此进行测试,因此您可能需要对其进行调整,但它显示了如何检查这些特定名称。祝你好运。
tell application "System Events"
set javaProcesses to processes whose name is "java"
repeat with aJavaProcess in javaProcesses
tell aJavaProcess
try
set windowName to name of window 1
set buttonNames to title of buttons of tab group 1 of window 1
if windowName is "Java Control Panel" and "Update Now" is in buttonNames then
click (first button of tab group 1 of window 1 whose title is "Update Now")
exit repeat
end if
end try
end tell
end repeat
end tell
编辑:也许你可以像这样得到正确的过程......
tell application "System Events"
set javaIDs to unix id of processes whose name is "java"
repeat with i from 1 to count of javaIDs
set aJavaProcess to (first process whose unix id is (item i of javaIDs))
tell aJavaProcess
-- do the stuff in the tell block from the code above
end tell
end repeat
end tell