Guest User

Untitled

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