Advertisement
lyogadi

Pause In AutoIt

Apr 20th, 2018
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 1.08 KB | None | 0 0
  1. #include <ButtonConstants.au3>
  2. #include <GUIConstantsEx.au3>
  3. #include <WindowsConstants.au3>
  4. #include <MsgBoxConstants.au3>
  5.  
  6. HotKeySet("{f1}", "begin")
  7. HotKeySet("{f3}", "pause")
  8.  
  9. #Region ### START Koda GUI section ### Form=
  10. $Form1 = GUICreate("Form1", 336, 72, 192, 124)
  11. $btn_begin = GUICtrlCreateButton("Start Click", 16, 16, 137, 33)
  12. $btn_pause = GUICtrlCreateButton("Pause / Resume", 184, 16, 137, 33)
  13. GUISetState(@SW_SHOW)
  14. #EndRegion ### END Koda GUI section ###
  15.  
  16. While 1
  17.     $nMsg = GUIGetMsg()
  18.     Switch $nMsg
  19.         Case $GUI_EVENT_CLOSE
  20.             Exit
  21.         Case $btn_begin
  22.             begin()
  23.         Case $btn_pause ; if i press f3 func begin() is pause, but when i click button pause not work, why?
  24.             pause()
  25.     EndSwitch
  26. WEnd
  27.  
  28. Func begin()
  29.     While 1
  30.         ToolTip('Script is Running"', 500, 500)
  31.         Delay(1000)
  32.     WEnd
  33. EndFunc ;==>begin
  34.  
  35. Func pause()
  36.     ToolTip('Script is Paused"', 500, 500)
  37.     MsgBox(0, "Paused", "Press OK to continue..")
  38. EndFunc ;==>pause
  39.  
  40. Func Delay($sleep)
  41.     For $i = 0 to $sleep
  42.         Sleep(10)
  43.         If GUIGetMsg() = $btn_pause Then
  44.             pause()
  45.             ExitLoop
  46.         EndIf
  47.     next
  48. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement