Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. on waitForWin(check_name, time_out)
  2. set wait_time to 0
  3.  
  4. tell application "System Events"
  5. repeat while (wait_time < time_out)
  6. set frontApp to first application process whose frontmost is true
  7. set frontAppName to name of frontApp
  8. tell process frontAppName
  9. tell (1st window whose value of attribute "AXMain" is true)
  10. set windowTitle to value of attribute "AXTitle"
  11. end tell
  12. end tell
  13.  
  14. if check_name is in windowTitle then exit repeat
  15. delay 1
  16. set wait_time to wait_time + 1
  17. end repeat
  18.  
  19. if wait_time >= time_out then
  20. display dialog "[timeout] didn't find '" & check_name & "' in window: " & windowTitle
  21. else
  22. display dialog "find " & check_name & " in window: " & windowTitle
  23. end if
  24.  
  25. end tell
  26. end waitForWin
  27.  
  28. my waitForWin("some text", 3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement