Guest User

Untitled

a guest
Apr 7th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 1.30 KB | None | 0 0
  1. #cs ----------------------------------------------------------------------------
  2.  
  3.  AutoIt Version: 3.3.6.1
  4.  Author:         FreeCoder
  5.  
  6.  Script Function:
  7.     Example AutoIt script.
  8.  
  9. #ce ----------------------------------------------------------------------------
  10.  
  11. #include <GUIConstantsEx.au3>
  12.  
  13. Global $timer = 0
  14.  
  15. Global $hGui      = GUICreate("Test", 320, 40)
  16. Global $checkBox1 = GUICtrlCreateCheckbox("Timer:", 20, 10)
  17. Global $textBox1  = GUICtrlCreateInput("5", 75, 10)
  18. Global $label1    = GUICtrlCreateLabel("Sekunden", 135, 13)
  19. Global $button1   = GUICtrlCreateButton("Start", 190, 8, 50)
  20. Global $button2   = GUICtrlCreateButton("Stop", 250, 8, 50)
  21.  
  22. GUISetState(@SW_SHOW, $hGui)
  23.  
  24. While True
  25.     ; Checkout GUI events...
  26.     $msg = GUIGetMsg()
  27.     Switch $msg
  28.         Case -3
  29.             Exit
  30.         Case $button1
  31.             $timer = TimerInit()
  32.         Case $button2
  33.             $timer = 0
  34.     EndSwitch
  35.  
  36.     ; Disable/Enable Textbox
  37.     Local $state = GUICtrlRead($checkBox1)
  38.     If $state = 1 Then
  39.         GUICtrlSetState($textBox1, $GUI_ENABLE)
  40.     ElseIf $state = 4 Then
  41.         GUICtrlSetState($textBox1, $GUI_DISABLE)
  42.     EndIf
  43.     ConsoleWrite((TimerDiff($timer) / 1000) & @CRLF)
  44.     ; Timer reaction
  45.     If $timer > 0 And (TimerDiff($timer) / 1000) >= GUICtrlRead($textBox1) Then
  46.         Reinit()
  47.     EndIf
  48.  
  49.     ; Sleep a while... ^^
  50.     Sleep(50)
  51. WEnd
  52.  
  53. Func Reinit()
  54.     $timer = TimerInit()
  55.     MsgBox(64, "", "Entjungfert xD")
  56. EndFunc
Add Comment
Please, Sign In to add comment