Sign in to follow this  
Followers 0
CrazyTasty

AutoIt executable runs twice

4 posts in this topic

I have a script that does an uninstall of an app and then an install of the same app.

Later in the script I run a command line argument through a cmd.exe window that restores a MySql database.

When running this in the editor everything works fine; however, it I generate an executable and run it, it seems to run twice.

Once it reaches the command line part, the entire script starts to run again.

I did notice when running in the editor, that it opens a new blank window in the editor.

Here's a snippet of the command line piece.

$dbVar = 'C:\WINDOWS\system32\cmd.exe /C "C:\MySQL Server 5.1\bin\mysql.exe" -u root -p coresearch < C:\Temp\dump.sql'
Run($dbVar)

Any help is appreciated...

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Maybe this will help:

From help file -

To run DOS (console) commands, try Run(@ComSpec & " /c " & 'commandName', "", @SW_HIDE) ; don't forget " " before "/c"

Edited by dufran3

Share this post


Link to post
Share on other sites

Hi CrazyTasty,

maybe you want to show us more of your script, as from the Run Command we cannot tell you what goes wrong.

Except your script is called mysql.exe and is located in "C:\MySQL Server 5.1\bin\" ... :unsure:


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

Here's the simple script that does the uninstall, install and database load.

I know having the Sleep function is a bad idea, but I've tried other things that didn't work how I expected them to work. Keep in mind I'm a newbie to this tool.

When I run this through a compiled executable, and when it gets to the bottom piece (where the database is loaded through the command line) the entire script executes again or some weird mouse clicks occur outside of the process (stuff is clicked in a different app that might be opened)

$unVar = @ProgramFilesDir & "\CoResearch\unins000.exe"  
Run($unVar)

Sleep(2000)
WinWaitActive("CoResearch Uninstall")
Send("!Y")
Send("{ENTER}")

Sleep(3000)
WinWaitActive("CoResearch Uninstall")
Send("!O")
Send("{ENTER}")

$inVar = "C:\Temp\setup.exe"  
Run($inVar)

Sleep(2000)
WinWaitActive("Setup - CoResearch")
Send("!N")
Send("{ENTER}")

Sleep(2000)
;WinWaitActive("Setup - CoResearch")
Send("!N")
Send("{ENTER}")

Sleep(2000)
;WinWaitActive("Setup - CoResearch")
Send("!I")
Send("{ENTER}")

Sleep(5000)
;WinWaitActive("Setup - CoResearch")
Send("!F")
Send("{ENTER}")

; Do the database here
RunWait(@ComSpec & " /c " & '"C:\MySQL Server 5.1\bin\mysql.exe" -u root -pr00t coresearch < C:\Temp\dump.sql', "",@SW_HIDE)
MsgBox(0,"AutoIt", "Upgrade Complete...")

Share this post


Link to post
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
Sign in to follow this  
Followers 0