probedrone Posted August 14, 2006 Share Posted August 14, 2006 If I want to run a series of tests in the dos command window, how to I tell autoit to pause until an operation is done? Not using Sleep() of course For example: (AutoIt Script: Send("xxx.exe"), Send("{ENTER}")) (Shown on cmd.exe) C:\Documents and Settings\user name>xxx.exe xxx.exe installing... please wait xxx.exe finished installing Continue AutoIt script Link to comment Share on other sites More sharing options...
omglol Posted August 14, 2006 Share Posted August 14, 2006 it might work, but maybe make a While/WEnd loop with on top like While WinExists, sort of like HotKeySet("{Home}", "Install") Func Install() Send("...xxx.exe") While WinExists("Installation WindowName") Sleep(100) WEnd ; continue script here EndFunc hope it helps Link to comment Share on other sites More sharing options...
probedrone Posted August 14, 2006 Author Share Posted August 14, 2006 The thing is no new windows pop up, the installation process is only shown in the command prompt window Link to comment Share on other sites More sharing options...
omglol Posted August 14, 2006 Share Posted August 14, 2006 maybe let it somehow find the line "installation done" in dos and then proceed, wouldn't know if that could work. good luck. Link to comment Share on other sites More sharing options...
omglol Posted August 14, 2006 Share Posted August 14, 2006 (edited) I hate double posts -__- Edited August 14, 2006 by omglol Link to comment Share on other sites More sharing options...
probedrone Posted August 14, 2006 Author Share Posted August 14, 2006 (edited) Im running different test programs and they may not always end up with the same "installation done" line. Anyway AutoIt cant detect lines from a dos window. Is there a way to check the process of a window and when it is done? Im not sure how to use the ProcessWait() command in my script tho. Any help would be nice. Edited August 14, 2006 by probedrone Link to comment Share on other sites More sharing options...
omglol Posted August 14, 2006 Share Posted August 14, 2006 (edited) HotKeySet("{Home}", "Install") Func Install() Send("...xxx.exe") While ProcessExists("Installation") Sleep(100) WEnd ; continue script here EndFunc ??? just giving some ideas i wouldn't know if it works, so let me know Edit: nasty typo Edited August 14, 2006 by omglol Link to comment Share on other sites More sharing options...
flyingboz Posted August 14, 2006 Share Posted August 14, 2006 If you're using 3.2 you may wish to take a look at the StdOutRead() function. Reading the help file before you post... Not only will it make you look smarter, it will make you smarter. Link to comment Share on other sites More sharing options...
probedrone Posted August 14, 2006 Author Share Posted August 14, 2006 If you're using 3.2 you may wish to take a look at the StdOutRead() function.Yea Im kinda newbie at AutoIt. I got beta but cant figure out how stdoutread can help in my program, any advice (or piece of code) would be great.Also, omglol, it would be best if your solution can work, but I dont know what "Installation" is. Am I supposed to fill in the name of my own program? How do I do that if the process is not shown? Link to comment Share on other sites More sharing options...
bluebearr Posted August 14, 2006 Share Posted August 14, 2006 (edited) Suppose you have this batch file that puts stuff up on the screen periodically: @echo off set _wf=%TEMP%\~wait.tmp echo wscript.sleep WScript.Arguments(0)>%_wf% echo Starting_1 echo Here is where you do something cscript %_wf% 5000 //NOLOGO //E:VBSCRIPT echo Done_1 cscript %_wf% 5000 //NOLOGO //E:VBSCRIPT echo Starting_2 echo Here is where you do something else cscript %_wf% 7000 //NOLOGO //E:VBSCRIPT echo Done_2 cscript %_wf% 5000 //NOLOGO //E:VBSCRIPT del %_wf% set _wf= You can use something like this to tell what is going on: SplashTextOn("MyProgress", "Now installing", 300, 100) $CHILDDOS = Run(@ComSpec & ' /c "' & @ScriptDir & '\test.bat"', @ScriptDir, @SW_MINIMIZE, 2) While 1 $Status = StdoutRead($CHILDDOS) If @error Then ExitLoop Select Case StringInStr($Status, "Starting_1") ControlSetText("MyProgress", "", "Static1", "Now installing program 1") Case StringInStr($Status, "Done_1") ControlSetText("MyProgress", "", "Static1", "Done install 1") Case StringInStr($Status, "Starting_2") ControlSetText("MyProgress", "", "Static1", "Now installing program 2") Case StringInStr($Status, "Done_2") ControlSetText("MyProgress", "", "Static1", "Done install 2") EndSelect Sleep(10) WEnd SplashOff() Edited August 14, 2006 by bluebearr BlueBearrOddly enough, this is what I do for fun. Link to comment Share on other sites More sharing options...
omglol Posted August 14, 2006 Share Posted August 14, 2006 Yea Im kinda newbie at AutoIt. I got beta but cant figure out how stdoutread can help in my program, any advice (or piece of code) would be great.Also, omglol, it would be best if your solution can work, but I dont know what "Installation" is. Am I supposed to fill in the name of my own program? How do I do that if the process is not shown?I wouldn't know for sure if it would work in the first place, you'd have to check that out by yourself...anyways i'm sorry that i didn't clearafy that when i posted the piece of code, but when you type ProcessExists( it'll show you to put the name of the process in there, wich will be in the task manager when you've started the installation at processes i think, never worked with it myself, again it's up to you to test it out good luck. Link to comment Share on other sites More sharing options...
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