hasoon2000 Posted March 17, 2012 Posted March 17, 2012 Hey guys. I was looking through mulitple threads about this, but I can't seem to fix the issue. I am trying to make a nice GUI for rooting Android phones. Here is my code #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $List1 = GUICtrlCreateList("", 24, 56, 121, 110) GUICtrlSetData(-1, "1. Install HTC Drivers|2. Register at HTCDev|3. Get Token ID|4. Submit Token ID|5. Unlock Bootloader") $Label1 = GUICtrlCreateLabel("Root the phone. Follow in order", 24, 16, 152, 17) $List2 = GUICtrlCreateList("", 304, 56, 97, 84) GUICtrlSetData(-1, "1. CWM 5.0.2.7|2. CWM 5.5.0.4|3. CWM Touch|4. TWRP 2.0.0|5. Stock") $Label2 = GUICtrlCreateLabel("Next, Flash a Recovery.", 160, 72, 118, 17) $Go = GUICtrlCreateButton("Go", 48, 176, 65, 17) $Flash = GUICtrlCreateButton("Flash", 320, 176, 65, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;Default Variables $recov= "" ;Default commands $5027 = RunWait(@ComSpec & " /K " & @ScriptDir & "\data\FlashCWM5027.bat", @ScriptDir & "\data\", @SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case 1 $selected = GUICtrlRead($Flash) switch $selected Case "1. CWM 5.0.2.7" $recov = $5027 EndSwitch WEnd I was trying to follow a source code for a GUI that was made for a different phone, but I guess it isn't working for me.
Bowmore Posted March 17, 2012 Posted March 17, 2012 In your code you have 2 Switch statements but only 1 EndSwitch statement This is your scriot with the required correction #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $List1 = GUICtrlCreateList("", 24, 56, 121, 110) GUICtrlSetData(-1, "1. Install HTC Drivers|2. Register at HTCDev|3. Get Token ID|4. Submit Token ID|5. Unlock Bootloader") $Label1 = GUICtrlCreateLabel("Root the phone. Follow in order", 24, 16, 152, 17) $List2 = GUICtrlCreateList("", 304, 56, 97, 84) GUICtrlSetData(-1, "1. CWM 5.0.2.7|2. CWM 5.5.0.4|3. CWM Touch|4. TWRP 2.0.0|5. Stock") $Label2 = GUICtrlCreateLabel("Next, Flash a Recovery.", 160, 72, 118, 17) $Go = GUICtrlCreateButton("Go", 48, 176, 65, 17) $Flash = GUICtrlCreateButton("Flash", 320, 176, 65, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;Default Variables $recov= "" ;Default commands $5027 = RunWait(@ComSpec & " /K " & @ScriptDir & "dataFlashCWM5027.bat", @ScriptDir & "data", @SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case 1 $selected = GUICtrlRead($Flash) switch $selected Case "1. CWM 5.0.2.7" $recov = $5027 EndSwitch ;<============== This line was missing EndSwitch WEnd "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook
hasoon2000 Posted March 17, 2012 Author Posted March 17, 2012 Awesome. It worked. Now a new issue. When it opens, it automatically runs the .bat command that I have. What I want it to do is when I select and option and press "Flash", it does the option that I chose.
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