brandonms Posted March 10, 2011 Share Posted March 10, 2011 (edited) I'm having issues where I can't exit my code without ending the process. Heres a quick snippet of my code. After I select the radio button, it needs to continuously check Func Himes() Thanks for your help GUI() Func GUI() Local $radio1, $radio2, $radio3, $radio4, $radio5, $radio6, $radio7, $radio8, _ $radio9, $radio10, $radio11, $radio12, $radio13, $radio14, $radio15, $msg GUICreate($login, 180, 460) $radio1 = GUICtrlCreateRadio("Encounter with the Buddha", 10, 10, 170, 20) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED Himes() EndSelect WEnd EndFunc Func Himes() While 1 getMapID() ;Himes If $mapID = 800020120 Then ControlClick("GMS", $login, "[CLASS:Static; INSTANCE:52]") ControlSetText("bRush", "", "[CLASS:Edit; INSTANCE:2]", "800020130") ControlClick("bRush", "", "[CLASS:Button; INSTANCE:1]") ControlClick("GMS", $login, "[CLASS:Static; INSTANCE:52]") Sleep(10000) EndIf WEnd EndFunc ;==>Himes Edited March 10, 2011 by brandonms Link to comment Share on other sites More sharing options...
jvanegmond Posted March 10, 2011 Share Posted March 10, 2011 For example: expandcollapse popupGUI() Func GUI() Local $radio1, $radio2, $radio3, $radio4, $radio5, $radio6, $radio7, $radio8, _ $radio9, $radio10, $radio11, $radio12, $radio13, $radio14, $radio15, $msg GUICreate($login, 180, 460) $radio1 = GUICtrlCreateRadio("Encounter with the Buddha", 10, 10, 170, 20) GUISetState() $doHimes = False While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED $doHimes = True EndSelect WEnd If $doHimes Then Himes() EndIf WEnd EndFunc Func Himes() getMapID() ;Himes If $mapID = 800020120 Then ControlClick("GMS", $login, "[CLASS:Static; INSTANCE:52]") ControlSetText("bRush", "", "[CLASS:Edit; INSTANCE:2]", "800020130") ControlClick("bRush", "", "[CLASS:Button; INSTANCE:1]") ControlClick("GMS", $login, "[CLASS:Static; INSTANCE:52]") Sleep(10000) EndIf EndFunc ;==>Himes Or you can do GUIGetMsg in Func Himes() and handle them. github.com/jvanegmond Link to comment Share on other sites More sharing options...
brandonms Posted March 10, 2011 Author Share Posted March 10, 2011 I see what you did there... Thank you for the timely response. P.S. There was an extra WEnd in there Link to comment Share on other sites More sharing options...
brandonms Posted March 10, 2011 Author Share Posted March 10, 2011 (edited) Now I'm having an issue where if switch from Himes() to a second fuction, it keeps looping Himes() I'm guessing that I would be better off using a check box? Edited March 10, 2011 by brandonms Link to comment Share on other sites More sharing options...
Carlo84 Posted March 10, 2011 Share Posted March 10, 2011 (edited) Now I'm having an issue where if switch from Himes() to a second fuction, it keeps looping Himes() I'm guessing that I would be better off using a check box? Whats with all the loops? you dont need to check for a msg from $radio1 AND check if its checked, just check for the last. GUI() Func GUI() Local $radio1, $radio2, $radio3, $radio4, $radio5, $radio6, $radio7, $radio8, _ $radio9, $radio10, $radio11, $radio12, $radio13, $radio14, $radio15, $msg GUICreate($login, 180, 460) $radio1 = GUICtrlCreateRadio("Encounter with the Buddha", 10, 10, 170, 20) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case GUICtrlRead($radio1) = $GUI_CHECKED Himes() EndSelect WEnd EndFunc Func Himes() getMapID() ;Himes If $mapID = 800020120 Then ControlClick("GMS", $login, "[CLASS:Static; INSTANCE:52]") ControlSetText("bRush", "", "[CLASS:Edit; INSTANCE:2]", "800020130") ControlClick("bRush", "", "[CLASS:Button; INSTANCE:1]") ControlClick("GMS", $login, "[CLASS:Static; INSTANCE:52]") Sleep(10000) EndIf EndFunc ;==>Himes As for your second problem i suppose in the full script that other function is called in the same select sequense? if so it doesnt get checked when the checkbox is checked. GUI() Func GUI() Local $radio1, $radio2, $radio3, $radio4, $radio5, $radio6, $radio7, $radio8, _ $radio9, $radio10, $radio11, $radio12, $radio13, $radio14, $radio15, $msg GUICreate($login, 180, 460) $radio1 = GUICtrlCreateRadio("Encounter with the Buddha", 10, 10, 170, 20) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If GUICtrlRead($radio1) = $GUI_CHECKED Then Himes() WEnd EndFunc ;==>GUI Func Himes() getMapID() ;Himes If $mapID = 800020120 Then ControlClick("GMS", $login, "[CLASS:Static; INSTANCE:52]") ControlSetText("bRush", "", "[CLASS:Edit; INSTANCE:2]", "800020130") ControlClick("bRush", "", "[CLASS:Button; INSTANCE:1]") ControlClick("GMS", $login, "[CLASS:Static; INSTANCE:52]") Sleep(10000) EndIf EndFunc ;==>Himes or something like that Edited March 10, 2011 by Djarlo _SplashProgressImage | _Regionselector | _IsPressed360 | _UserAccountContol_SetLevel | _ListSubFolders 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