Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on waitForWin(check_name, time_out)
- set wait_time to 0
- tell application "System Events"
- repeat while (wait_time < time_out)
- set frontApp to first application process whose frontmost is true
- set frontAppName to name of frontApp
- tell process frontAppName
- tell (1st window whose value of attribute "AXMain" is true)
- set windowTitle to value of attribute "AXTitle"
- end tell
- end tell
- if check_name is in windowTitle then exit repeat
- delay 1
- set wait_time to wait_time + 1
- end repeat
- if wait_time >= time_out then
- display dialog "[timeout] didn't find '" & check_name & "' in window: " & windowTitle
- else
- display dialog "find " & check_name & " in window: " & windowTitle
- end if
- end tell
- end waitForWin
- my waitForWin("some text", 3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement