Advertisement
Guest User

Untitled

a guest
Sep 13th, 2019
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. Fn_OpenOrWait(findWindow,waitTime,openLink:=false) {
  2. if (WinActive(findWindow))
  3. {
  4. return true
  5. }
  6. WinActivate, %findWindow%
  7. if (WinActive(findWindow))
  8. {
  9. return true
  10. }
  11. if (openLink)
  12. {
  13. Run %openLink%
  14. }
  15. if (!Fn_Countdown(findWindow, waitTime))
  16. {
  17. return false
  18. }
  19. Return true
  20. }
  21.  
  22. Fn_Countdown(findWindow,waitTime) {
  23. found := false
  24. While ((waitTime > 0) and (!found))
  25. {
  26. if GetKeyState("Esc")
  27. waitTime := 0
  28. if (WinActive(findWindow))
  29. found = true
  30. ToolTip, % waitTime
  31. Sleep, 1000
  32. waitTime--
  33. }
  34. ToolTip
  35. return found
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement