Public3nemy Posted September 22, 2009 Share Posted September 22, 2009 #include <GUIConstantsEx.au3> GUICreate("Help File", 335, 40) GUICtrlCreateLabel("Time", 8, 8) $inputtime = GUICtrlCreateInput("", 40, 8, 95) $startbutton = GUICtrlCreateButton("Start", 190, 8, 60) $stopbutton = GUICtrlCreateButton("Stop", 266, 8, 60) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $startbutton $time = GUICtrlRead($inputtime) While 1 Send("Hello!") Sleep($time) WEnd Case $msg = $stopbutton ExitLoop Case $msg = $GUI_EVENT_CLOSE GUIDelete() ExitLoop EndSelect WEnd For some reason when I add the time it still sends the key at the default time with no delay? =[ Link to comment Share on other sites More sharing options...
dantay9 Posted September 22, 2009 Share Posted September 22, 2009 What are you entering into the input box? You are probably entering seconds. If so, then you should read the help file a bit more carefully. For sleep, you must use milliseconds. So type in 5000 (5 seconds) and it should work. Link to comment Share on other sites More sharing options...
Public3nemy Posted September 22, 2009 Author Share Posted September 22, 2009 What are you entering into the input box? You are probably entering seconds. If so, then you should read the help file a bit more carefully. For sleep, you must use milliseconds. So type in 5000 (5 seconds) and it should work. Oh man, can't believe I didn't pick that up. How about if it asked for 2 inputs of time but when the user doesn't enter anthing in the second input the program skips it and just spams the first input that the user gave. So if its left null it shouldn't send. Would I have to make an if statement? How would I do that? expandcollapse popup#include <GUIConstantsEx.au3> GUICreate("Help File", 335, 100) GUICtrlCreateLabel("Time1", 8, 8) GUICtrlCreateLabel("Time2", 8, 35) $inputtime1 = GUICtrlCreateInput("", 40, 8, 95) $inputtime2 = GUICtrlCreateInput("", 40, 35, 95) $startbutton = GUICtrlCreateButton("Start", 190, 8, 60) $stopbutton = GUICtrlCreateButton("Stop", 266, 8, 60) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $startbutton $time1 = GUICtrlRead($inputtime1) $time2 = GUICtrlRead($inputtime2) While 1 Send("Hello!") Sleep($time1) Send("What's up man?") sleep($time2) WEnd Case $msg = $stopbutton ExitLoop Case $msg = $GUI_EVENT_CLOSE GUIDelete() ExitLoop EndSelect WEnd Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now