bistrader Posted August 6, 2006 Share Posted August 6, 2006 I prepared the following to run a batch file on a Windows 2000 PC. The batch file ends by pulling up a txt file. My understanding is that by using RunWait that the 2 send commands that follow will NOT be executed until RunWait is completed. Yet, the txt file does NOT close. I would like help with 2 issues: how might I change the following to close the txt file without using Sleep; and, what is another way to do this if I simply use Run to execute a none-batch file (say for a js, java script, file). Thanks for the help. ; Define the Path and batch file Dim $PathToYourShortCut = "C:\Ftrade\example.bat" ; Path to the Folder where your shortcut resigns Dim $DirToYourShortCut = StringLeft($PathToYourShortCut, StringInStr($PathToYourShortCut, "\", 0, -1)) ; FileName of the shortcut Dim $ShortCutName = StringRight($PathToYourShortCut, StringLen($PathToYourShortCut)-StringInStr($PathToYourShortCut, "\", 0, -1)) ; Run CommandPrompt (telling it to run ShortCut file, but RunWait tells cmd.exe ( @ComSpec ) to start in the shortcut's folder. RunWait(@ComSpec & " /c " & $ShortCutName, $DirToYourShortCut, @SW_MINIMIZE) ; Quit via Alt-f and then x (File menu -> Exit) Send("!f") Send("x") ...... Link to comment Share on other sites More sharing options...
ChrisL Posted August 6, 2006 Share Posted August 6, 2006 If I want to run a program and wait for it to close but also continue with checking other things I use something like $process = Run ("the program.exe") While ProcessExists($process) ;check some stuff or do some stuff ;etc ;etc Wend [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
dingo Posted August 6, 2006 Share Posted August 6, 2006 How about if you don't need to check other things? Just run and hang till the job finishes.. d Link to comment Share on other sites More sharing options...
bistrader Posted August 6, 2006 Author Share Posted August 6, 2006 Don't need to or want to hang as have other AutoIt work to do. Would like AutoIt to preceed with next step as soon as possible. So, I still do not know how to tell AutoIt to wait until done with the nth step prior to processing the nth + 1 step. Maybe you or others have know how and will post. Thanks .. Link to comment Share on other sites More sharing options...
dingo Posted August 7, 2006 Share Posted August 7, 2006 (edited) Then his routine will allow you to go to the next step(s) immediately. $FirstStep = Run ("the first Step") do the second step do the nth step While ProcessExists($FirstStep ) Wend Edited August 7, 2006 by dingo 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