Fabroni Posted July 23, 2008 Share Posted July 23, 2008 I would like to make script like whenever you press button 1, wait 10 second and then send button 2 Below is my code Global $Paused, $Runner HotKeySet("{PAUSE}", "Pause") HotKeySet("{ESC}", "Terminate") HotKeySet("{F12}", "Start") While 1 Sleep(100) WEnd Func Pause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Func Start() $Runner = Not $Runner While $Runner ;if button 1 was push, wait 10 seconds and send button2 --> getting stuck here Sleep(10000) Send("{2}") WEnd EndFunc Link to comment Share on other sites More sharing options...
Andreik Posted July 23, 2008 Share Posted July 23, 2008 I would like to make script like whenever you press button 1, wait 10 second and then send button 2 Below is my code Global $Paused, $Runner HotKeySet("{PAUSE}", "Pause") HotKeySet("{ESC}", "Terminate") HotKeySet("{F12}", "Start") While 1 Sleep(100) WEnd Func Pause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Func Start() $Runner = Not $Runner While $Runner ;if button 1 was push, wait 10 seconds and send button2 --> getting stuck here Sleep(10000) Send("{2}") WEnd EndFunc $GUI = GUICreate("TEST",400,400,-1,-1) $B1 = GUICtrlCreateButton("No1",150,150,100,50) $B2 = GUICtrlCreateButton("No2",150,250,100,50) GUISetState() While 1 $MSG = GUIGetMsg() Switch $MSG Case -3 Exit Case $B1 TrayTip("","BUTTON 1 WAS PRESSED",3) SecondButton() Case $B2 TrayTip("","BUTTON 2 WAS PRESSED",3) EndSwitch WEnd Func SecondButton() Sleep(10000) ControlClick("TEST","",$B2) EndFunc When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Fabroni Posted July 23, 2008 Author Share Posted July 23, 2008 $GUI = GUICreate("TEST",400,400,-1,-1) $B1 = GUICtrlCreateButton("No1",150,150,100,50) $B2 = GUICtrlCreateButton("No2",150,250,100,50) GUISetState() While 1 $MSG = GUIGetMsg() Switch $MSG Case -3 Exit Case $B1 TrayTip("","BUTTON 1 WAS PRESSED",3) SecondButton() Case $B2 TrayTip("","BUTTON 2 WAS PRESSED",3) EndSwitch WEnd Func SecondButton() Sleep(10000) ControlClick("TEST","",$B2) EndFunc Thanks but I dont mean graphic button. They are button number on keyboard. Can you please help me ? Link to comment Share on other sites More sharing options...
Andreik Posted July 23, 2008 Share Posted July 23, 2008 (edited) Thanks but I dont mean graphic button. They are button number on keyboard. Can you please help me ? If you press TAB key after 10 sec script send A. If you press ESC key then Exit. #include <Misc.au3> While 1 If _IsPressed("09") Then Sleep(10000) Send("A") ElseIf _IsPressed("1B") Then Exit EndIf Sleep(15) WEnd Edited July 23, 2008 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Fabroni Posted July 23, 2008 Author Share Posted July 23, 2008 (edited) If you press TAB key after 10 sec script send A. If you press ESC key then Exit. #include <Misc.au3> While 1 If _IsPressed("09") Then Sleep(10000) Send("A") ElseIf _IsPressed("1B") Then Exit EndIf Sleep(15) WEnd Great. By the way how can you get the value TAB is 09? Is there any website to list all those value? Edited July 23, 2008 by Fabroni Link to comment Share on other sites More sharing options...
Andreik Posted July 23, 2008 Share Posted July 23, 2008 1B is ESC key to exit from script. Look in help file about _IsPressed(). When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Fabroni Posted July 23, 2008 Author Share Posted July 23, 2008 1B is ESC key to exit from script. Look in help file about _IsPressed().Thank you so much! 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