Jump to content

Run a .bat file?


Recommended Posts

Sorry guys. I did a few things and it is looking better but I still have an issue. I click the button and the script runs BUT it goes away. I need it to show and have the user interact with it. I have pause commands in the .bat files. The autoit script so far looks like this

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $TokenID
    Run(@ComSpec & " /C " & "dataTokenID.bat", "", @SW_SHOW)
  Case $CMW5027
     Run(@ComSpec & " /C " & "dataFlashCWM5027.bat", "", @SW_SHOW)
  Case $LockBootloader
     Run(@ComSpec & " /C " & "dataRelockBootloader.bat", "", @SW_SHOW)
   Case $CWM5504
    Run(@ComSpec & " /C " & "dataFlashCWM5504.bat", "", @SW_SHOW)
EndSwitch
WEnd

One of the bat commands looks like this

:cd %:h
fastboot flash recovery recovery-cwm-ruby-5.0.2.7.img
fastboot reboot
pause

I tried using _Run, _Rundos, Runwait. Still does the same thing. The script runs but goes away real quick.

Edited by hasoon2000
Link to comment
Share on other sites

  • Developers

Well.. this should tell you something ...no?

If you want us to help you will have to explain more about your exact scriptfile location and the bat file locations.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Well.. this should tell you something ...no?

If you want us to help you will have to explain more about your exact scriptfile location and the bat file locations.

Jos

I have all the files in my Dropbox Folder (So it can sync to all my laptops so I can work at it when I am home, work, school).

All the files and data are in a folder. Here is my directory for it

C:UsersOdaiDropboxPhonesAmazeGUISourceData

The .au3 and .kxf files are in

C:UsersOdaiDropboxPhonesAmazeGUISource

In my script, I have one of the lines reading it at

Case $Fastboot

Runwait(@ComSpec & " /K " & "dataBootIntoFastboot.bat", "", @SW_SHOW)

I have to respecify where to look at I believe is what you are telling me.

EDIT: I changed dataBootIntoFastboot.bat to the full path C:UsersOdaiDropboxPhonesAmazeGUISourceDataBootIntoFastboot.bat

and it runs the CMD BUT now it says

C:UsersOdaiDropboxPhonesAmazeGUISource>adb reboot recovery
'adb' is not recognized as an internal or external command,
operable program or batch file.
C:UsersOdaiDropboxPhonesAmazeGUISource>pause
Press any key to continue . . .

The .bat file's first line says

:cd %:h

So it can read all the files in the folder and execute them properly.

Edited by hasoon2000
Link to comment
Share on other sites

  • Developers

"DATA" means "c:data"

So you probably want:

Runwait(@ComSpec & ' /K "' & @ScriptDir & 'dataBootIntoFastboot.bat"', "", @SW_SHOW)

so, where is adb.exe (or .com) located?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

That makes sense as your workdir will be the scriptdir and thus not able to find the commands unless the PATH is set correctly.

So set the workdir in the Run command and you should be in business.

Runwait(@ComSpec & ' /K "' & @ScriptDir & 'dataBootIntoFastboot.bat"', @ScriptDir & "data", @SW_SHOW)
Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

That makes sense as your workdir will be the scriptdir and thus not able to find the commands unless the PATH is set correctly.

So set the workdir in the Run command and you should be in business.

Runwait(@ComSpec & ' /K "' & @ScriptDir & 'dataBootIntoFastboot.bat"', @ScriptDir & "data", @SW_SHOW)

I modified your code a bit because it didn't work. This worked for me

Runwait(@ComSpec & " /K " & @ScriptDir & "dataBootIntoFastboot.bat", @ScriptDir & "data", @SW_SHOW)

Thank you. I really appreciate all the help!

My last and final question is what is the command to open the Data folder. I have a button to put that folder so they can place a required item for Android phones.

Link to comment
Share on other sites

  • Developers

Something like this?:

$FilePath="c:temp"
ShellExecute("Explorer.exe",'/e,/root,"' & $FilePath & '"')

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Before I do that, I ran into a problem. I moved the folder with my .au3 file, my .kxf, and my Data folder to my desktop. Same setup that I had in my dropbox and when I press a button, it says

'C:UsersOdaiDesktopAmaze' is not recognized as an internal or external comma
nd,
operable program or batch file.
C:UsersOdaiDesktopAmaze All-In-One Kitdata>

But when I put it back in the original location, it would work.

EDIT:

When I name the folder with one word it will work. For example, I will place it on the desktop and make a folder called Amaze All-In-One Kit (3 words), it will not work. When I change the folder name to Amaze_All-In-One_Kit, it will then work.

Edited by hasoon2000
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...