Misha Posted March 18, 2006 Share Posted March 18, 2006 #include <GUIConstants.au3> GUICreate("Space Presser" ,120 ,50) $n2=GUICtrlCreateButton ("Space it",10 ,20) GUICtrlSetState(-1,$GUI_FOCUS) $n3=GuiCtrlCreateButton ("Exit it",70 ,20) GUISetState () Do $msg = GUIGetMsg() if $msg = $n2 then while $msg <> $n3 GuiGetMsg() send ( " " , 1) WEnd endif Until $msg = $n3 I press exit it wont exit please assist Link to comment Share on other sites More sharing options...
Valuater Posted March 18, 2006 Share Posted March 18, 2006 (edited) #include <GUIConstants.au3> GUICreate("Space Presser", 120, 50) $n2 = GUICtrlCreateButton("Space it", 10, 20) GUICtrlSetState(-1, $GUI_FOCUS) $n3 = GUICtrlCreateButton("Exit it", 70, 20) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Or $msg = $n3 Then Exit If $msg = $n2 Then Send(" ", 1) WEnd 8) BTW Welcome to the forums Edited March 18, 2006 by Valuater Link to comment Share on other sites More sharing options...
Misha Posted March 18, 2006 Author Share Posted March 18, 2006 (edited) Thanks mate works Ill be staying here and learning EDIT: Space it doesnt seem to work. Edited March 18, 2006 by Misha Link to comment Share on other sites More sharing options...
nfwu Posted March 18, 2006 Share Posted March 18, 2006 Problem: your GUI has focus, and so recieves the space intead of the target program Solution: make your GUI lose focus by minimising it, then restoring it after space is sent #include <GUIConstants.au3> $GUI = GUICreate("Space Presser", 120, 50) $n2 = GUICtrlCreateButton("Space it", 10, 20) GUICtrlSetState(-1, $GUI_FOCUS) $n3 = GUICtrlCreateButton("Exit it", 70, 20) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Or $msg = $n3 Then Exit EndIf If $msg = $n2 Then WinSetState($GUI, "", @SW_MINIMIZE) Send(" ", 1) WinSetState($GUI, "", @SW_RESTORE) EndIf WEnd Not Tested. #) TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
Misha Posted March 18, 2006 Author Share Posted March 18, 2006 fixed needed a while around the send and not needed that minimizer thingy.. Link to comment Share on other sites More sharing options...
Valuater Posted March 18, 2006 Share Posted March 18, 2006 where did you want to "send" to??? 8) 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