Jump to content

Yes No Cancel MSGbox


Recommended Posts

I've looked at the helpfile and searched around, but I guess I can't grasp the concept. I have an android rooting program. Trying to add new features. Now I'm stuck.

Case "ADB Sideload a ROM"
$sideload = MsgBox(3, "Pushing ROM to ADB Sideload...", "This will push your ROM as an ADB Sideload. Your phone must be in recovery. Is it in recovery?")
If $sideload = 6 Then
MsgBox(0, "Sideloading ROM...", "Please select ADB Sideload in recovery so we can sideload the ROM")
$message= "choose ROM to sideload"
$file1 = FileOpenDialog($message, @WindowsDir & "\", "Zip file(*.zip)",1+4)
Run('cmd.exe' & @ComSpec & '" /k ' & $CMD2 & $file1, "\data\", @SW_SHOW)
ElseIf $sideload = 7 Then
RunWait($CMD3, @ScriptDir & "\data\", @SW_SHOW)
MsgBox(0, "Rebooting into recovery...", "We are going to boot into recovery. Please select ADB Sideload in recovery so we can sideload the ROM")
ElseIf $sideload = 2 Then
ExitLoop
EndIf

This is how $sideload is set as.

$sideload = "adb.exe sideload"

$CMD2 is set up as $CMD2 ="adb.exe sideload"

$CMD3 is set up as $CMD3 = "fastboot.exe flash recovery"

I have adb.exe and fastboot.exe in the data folder.

When I click Yes, I see my msgbox. I hit ok and then the open dialog pops up and I can choose a zip file. When I hit ok, nothing happens. Nothing happens if I hit no or cancel.

It's been bugging me and I can't seem to solve it.

Edited by hasoon2000
Link to comment
Share on other sites

Code starts with a 'case' and it seems you're having some sort of program flow issue. Attach the whole code or more of it so I can run it and I'll take a look farther. :D

Edited by Xandy
Link to comment
Share on other sites

This is not a problem with your Message box code:

$sideload = MsgBox(3, "Pushing ROM to ADB Sideload...", "This will push your ROM as an ADB Sideload. Your phone must be in recovery. Is it in recovery?")
If $sideload = 6 Then
    MsgBox(0, "Sideloading ROM...", "Please select ADB Sideload in recovery so we can sideload the ROM")
    ;$message= "choose ROM to sideload"
    ;$file1 = FileOpenDialog($message, @WindowsDir & "\", "Zip file(*.zip)",1+4)
    ;Run('cmd.exe' & @ComSpec & '" /k ' & $CMD2 & $file1, "\data\", @SW_SHOW)
ElseIf $sideload = 7 Then
    ;RunWait($CMD3, @ScriptDir & "\data\", @SW_SHOW)
    MsgBox(0, "Rebooting into recovery...", "We are going to boot into recovery. Please select ADB Sideload in recovery so we can sideload the ROM")
ElseIf $sideload = 2 Then
    MsgBox(0, "Test", "Cancel is working")
    ;ExitLoop
EndIf

It's something else in your code that you must have overlooked. I don't know much about Android.

Edited by czardas
Link to comment
Share on other sites

I fixed a few things. What I need is when you choose "Yes", it will open cmd with the script ADB.exe Sideload (Then it'll flash the selected Zip)

EX: ADB.exe sideload AutoIT.zip

If you Choose "No", it'll run the command ADB.exe Reboot Bootloader

I'm messing with the Default commands. So if you see a repetition, then I'm still clearing it up.

Edited by hasoon2000
Link to comment
Share on other sites

I promised I'd look. Let me finish work. About 2 and 1/2 hours from this post.

Don't worry about the missing includes. It's happened to me as well, not sure why it happens.

Edited by Xandy
Link to comment
Share on other sites

Looks like it's working and a very useful program, not that I know anything about phone flashing, but I get the idea.

It looks like you're reusing variables such as $sideload = "adb.exe sideload" is set to a string.

Later $sideload is set to the msgbox() return. While this can be done and save memory, it can also be confusing and the string value is lost in the case were you might need it again. I don't know, I'm not the creator I suggest a different return variable for the msgbox() prompts until you get it working. After you have it working you can attempt to reuse variables to save memory, but who really cares about the trivial memory on a PC? It's probably good practice for phone programming, but like I said you can trim it up later.

Reusing the variable could also cause problems between string and numeric checks.

Anyhow I get different results for 'yes', no, and cancel when I hit the 'Run' button with the sideload selected.

I didn't test it farther then that, because I don't know what should be happening anyhow.

I'm sure it's just grouping the correct code to the correct checks, and you've got this. :)

Edited by Xandy
Link to comment
Share on other sites

Looks like it's working and a very useful program, not that I know anything about phone flashing, but I get the idea.

It looks like you're reusing variables such as $sideload = "adb.exe sideload" is set to a string.

Later $sideload is set to the msgbox() return. While this can be done and save memory, it can also be confusing and the string value is lost in the case were you might need it again. I don't know, I'm not the creator I suggest a different return variable for the msgbox() prompts until you get it working. After you have it working you can attempt to reuse variables to save memory, but who really cares about the trivial memory on a PC? It's probably good practice for phone programming, but like I said you can trim it up later.

Reusing the variable could also cause problems between string and numeric checks.

Anyhow I get different results for 'yes', no, and cancel when I hit the 'Run' button with the sideload selected.

I didn't test it farther then that, because I don't know what should be happening anyhow.

I'm sure it's just grouping the correct code to the correct checks, and you've got this. :)

I FINALLY got it to work! I guess I did a stupid mistake.

I changed this

$sideload = "adb.exe sideload"

into this

$ADBside = @ComSpec & " /K " & '"' & @ScriptDir & "dataadb.exe sideload "

I then changed the command to this

RunWait($ADBside & " " &$file1, @ScriptDir & "data", @SW_SHOW)

Issue was the $Sideload. I looked at my other commands and it had the directly to run the command.

Example:

$4EXT = @ComSpec & " /K " & '"' & @ScriptDir & "datafastboot.exe flash recovery Recoveries/4EXT.img"""

I tweaked it out and did trial and error. It FINALLY worked! This is a great tool for new and experienced Android users. I can fully root my phone with my tool in 5 mins. Manually (for me) will take no more than 15 minutes. Imagine new users who are not tech savvy at all! lol.

However, thank you for ALL your help. I really enjoy the community here and the help I get.

Xandy, thank you for taking time out to help me. I really do appreciate it!!

Merry Christmas and Happy Holidays to you guys :)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...