In Applescript, how can I correctly obtain values for a process window that is the not the front window?
I currently have an Applescript that takes values from Google Chrome, but it only works if Chrome is the front window. In the case Chrome is behind another window, it no longer works:
tell application "System Events"
repeat while "Chrome" is in (name of application processes)
try
tell process "Chrome" to set VALUE to value of every static text of every sheet of front window
if {{"somevalue"}} is in VALUE then
s
tell application "System Events" to key code 39
else
delay 1
end if
end try
end repeat
end tell
The problematic line is:
tell process "Chrome" to set VALUE to value of every static text of every sheet of front window
Is there a way to specify something else other than front window
while not running into bugs or bringing it to the front? Thanks!
Solution 1:
You could specify a different window, e.g. second window
; however, it will do you no good to specify a different window as System Events can only send a keystroke
or key code
to what's frontmost.