fly Posted June 10, 2008 Posted June 10, 2008 I'm calling my autoit script via command line (sometimes, as it also has a GUI). When I call it, the program starts and immediately returns control to the CMD window. How can I make it hold the cmd window until my program exits?
Airwolf Posted June 10, 2008 Posted June 10, 2008 I'm calling my autoit script via command line (sometimes, as it also has a GUI). When I call it, the program starts and immediately returns control to the CMD window. How can I make it hold the cmd window until my program exits?Are you trying to hide the command prompt window while the script is running? If so, you'll need to use WinSetState() with the @SW_HIDE flag. Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt
fly Posted June 10, 2008 Author Posted June 10, 2008 Are you trying to hide the command prompt window while the script is running? If so, you'll need to use WinSetState() with the @SW_HIDE flag.No, I'm just trying to hold the command prompt so that it doesn't continue on in my batch file until the Autoit program has finished...
k3v Posted June 10, 2008 Posted June 10, 2008 a little messy, but... run("cmd") dim $mycommand = "dir c:{ENTER}" sleep(250) send($mycommand)
fly Posted June 10, 2008 Author Posted June 10, 2008 a little messy, but... run("cmd") dim $mycommand = "dir c:{ENTER}" sleep(250) send($mycommand)I don't understand that...
ProgAndy Posted June 10, 2008 Posted June 10, 2008 Do you compile with AutoIt3Wrapper? Then use: #AutoIt3Wrapper_Change2CUI=y *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
Eigensheep Posted June 10, 2008 Posted June 10, 2008 (edited) What you're actually dealing with is a need for a command in the CMD environment not autoit. This should do the trick, please let me know either way: CODEstart /wait /b call "Path to program here" Obviously replace "Path to program here" with the path. I haven't fully tested the command, but it works with all the .au3 and .exe files i've tried. Edited June 10, 2008 by logicBird
fly Posted June 10, 2008 Author Posted June 10, 2008 Do you compile with AutoIt3Wrapper?Then use: #AutoIt3Wrapper_Change2CUI=yWill that still allow me to use GUI functions?What you're actually dealing with is a need for a command in the CMD environment not autoit. This should do the trick, please let me know either way:CODEstart /wait /b call "Path to program here"Obviously replace "Path to program here" with the path. I haven't fully tested the command, but it works with all the .au3 and .exe files i've tried.I could do that, but I'd rather have the syntax the same so that I don't confuse my coworkers too much...
cartman380 Posted June 10, 2008 Posted June 10, 2008 Will that still allow me to use GUI functions?I could do that, but I'd rather have the syntax the same so that I don't confuse my coworkers too much...When you say you're running from the command line, do you mean you're doing a start -> Run -> "script name here".exe?Or are you actually using a command prompt / cmd.exe?
fly Posted June 10, 2008 Author Posted June 10, 2008 When you say you're running from the command line, do you mean you're doing a start -> Run -> "script name here".exe?Or are you actually using a command prompt / cmd.exe?Im running it from cmd.exe
cartman380 Posted June 10, 2008 Posted June 10, 2008 Im running it from cmd.exe If you're just running from cmd.exe in your script you could use the WinSetState like so. WinSetState("cmd.exe", "", @SW_DISABLE) MsgBox(0, "Wait", "You may use command prompt window again when program is finished running", 5) ; program stuff here WinSetState("cmd.exe", "", @SW_ENABLE) I'm not sure if that is what you want, but it's what I could think of to wait until your program is done.
TurionAltec Posted June 11, 2008 Posted June 11, 2008 ProgAndy's advice is the best, that will compile the script as console app. You can still do all the GUI stuff you want and it can be called in normal ways Consequently you can also use ConsoleWrite() to have text show up in the cmd window that called autoit. Useful for showing messages. The only other real option is calling "Start /wait script.exe" from a Batch file or the command prompt.
fly Posted June 11, 2008 Author Posted June 11, 2008 ProgAndy's advice is the best, that will compile the script as console app. You can still do all the GUI stuff you want and it can be called in normal waysConsequently you can also use ConsoleWrite() to have text show up in the cmd window that called autoit. Useful for showing messages.The only other real option is calling "Start /wait script.exe" from a Batch file or the command prompt.Gotcha. Thanks again then guys!
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