sandra Posted May 19, 2009 Share Posted May 19, 2009 Please forgive me that I don't know much about AutoIt and programming language in general. I am trying to use AutoIt to call 6 scripts in a sequential order. The weird thing is it always started with the second script (rspan.ebs) first and then the first script (ospan.ebs), the rest were called in the right sequential order. Each individual ebs file works fine if is run separately. Does anyone have any idea? Thanks very much! Your help is really appreciated! Below is what I have: Run("C:\Program Files\PST\E-Prime\Program\E-Run.exe /a /m " & '"' & @Workingdir & '\ospan.ebs"') WinWait("E-Run") WinWaitClose("E-Run") Run("C:\Program Files\PST\E-Prime\Program\E-Run.exe /a /m " & '"' & @Workingdir & '\rspan.ebs"') WinWait("E-Run") WinWaitClose("E-Run") Run("C:\Program Files\PST\E-Prime\Program\E-Run.exe /a /m " & '"' & @Workingdir & '\paper.ebs"') WinWait("E-Run") WinWaitClose("E-Run") Run("C:\Program Files\PST\E-Prime\Program\E-Run.exe /a /m " & '"' & @Workingdir & '\letter.ebs"') WinWait("E-Run") WinWaitClose("E-Run") Run("C:\Program Files\PST\E-Prime\Program\E-Run.exe /a /m " & '"' & @Workingdir & '\arithematic.ebs"') WinWait("E-Run") WinWaitClose("E-Run") Run("C:\Program Files\PST\E-Prime\Program\E-Run.exe /a /m " & '"' & @Workingdir & '\categorization.ebs"') WinWait("E-Run") WinWaitClose("E-Run") Thanks, Sandra Link to comment Share on other sites More sharing options...
LurchMan Posted May 19, 2009 Share Posted May 19, 2009 ospan.ebs doesnt call the 2nd script does it?...looking at that code I don't see any reason why it would run the 2nd one first, is that an exact copy of your script? Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end. Link to comment Share on other sites More sharing options...
sandra Posted May 19, 2009 Author Share Posted May 19, 2009 Thanks so much for your reply! ospan.ebs doesn't call the 2nd script. All these are separate files. And it is an exact copy that I used. All these ebs files exist in the script's running directory (i.e., C:\Program Files\PST\E-Prime\Program). And the original command line saved in Windows XP "C:\Program Files\PST\E-Prime\Program\E-Run.exe" "%1" doesn't have the "/a/m" part, and I changed it and added "/a/m" there. Link to comment Share on other sites More sharing options...
wolf9228 Posted May 19, 2009 Share Posted May 19, 2009 (edited) Please forgive me that I don't know much about AutoIt and programming language in general. I am trying to use AutoIt to call 6 scripts in a sequential order. The weird thing is it always started with the second script (rspan.ebs) first and then the first script (ospan.ebs), the rest were called in the right sequential order. Each individual ebs file works fine if is run separately. Does anyone have any idea? Thanks very much! Your help is really appreciated! Below is what I have: Run("C:\Program Files\PST\E-Prime\Program\E-Run.exe /a /m " & '"' & @Workingdir & '\ospan.ebs"') WinWait("E-Run") WinWaitClose("E-Run") Run("C:\Program Files\PST\E-Prime\Program\E-Run.exe /a /m " & '"' & @Workingdir & '\rspan.ebs"') WinWait("E-Run") WinWaitClose("E-Run") Run("C:\Program Files\PST\E-Prime\Program\E-Run.exe /a /m " & '"' & @Workingdir & '\paper.ebs"') WinWait("E-Run") WinWaitClose("E-Run") Run("C:\Program Files\PST\E-Prime\Program\E-Run.exe /a /m " & '"' & @Workingdir & '\letter.ebs"') WinWait("E-Run") WinWaitClose("E-Run") Run("C:\Program Files\PST\E-Prime\Program\E-Run.exe /a /m " & '"' & @Workingdir & '\arithematic.ebs"') WinWait("E-Run") WinWaitClose("E-Run") Run("C:\Program Files\PST\E-Prime\Program\E-Run.exe /a /m " & '"' & @Workingdir & '\categorization.ebs"') WinWait("E-Run") WinWaitClose("E-Run") Thanks, Sandra For Console Application $File_Full_Path = @SystemDir & "\Notepad.exe" $Space = " " $Command1 = "C:\TxtFile.txt" $Command2 = $File_Full_Path & $Space & $Command1 RunWait($Command2, "", @SW_SHOW) Edited May 19, 2009 by wolf9228 صرح السماء كان هنا Link to comment Share on other sites More sharing options...
LurchMan Posted May 19, 2009 Share Posted May 19, 2009 (edited) For Console Application $File_Full_Path = @SystemDir & "\Notepad.exe" $Space = " " $Command1 = "C:\TxtFile.txt" $Command2 = $File_Full_Path & $Space & $Command1 RunWait($Command2, "", @SW_SHOW) i always over look the simple things for some reason..... Edited May 19, 2009 by LurchMan Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end. Link to comment Share on other sites More sharing options...
sandra Posted May 20, 2009 Author Share Posted May 20, 2009 Thanks for the help! Sorry I have to bother again to ask stupid questions ( I literally know nothing about programming). I tried the script for dialog application and below is what I used ( I am not sure whether I changed it correctly or not). $File_Full_Path = "c:\Program Files\PST\E-Prime\Program\E-Run.exe" $Space = " " $Command1 = "C:\strategy.ebs" $Command2 = $File_Full_Path & $Space & $Command1 Run($Command2, "", @SW_MAXIMIZE) WinWait(WinGetTitle ( "","")) WinWaitClose(WinGetTitle ( "","")) $File_Full_Path = "c:\Program Files\PST\E-Prime\Program\E-Run.exe" $Space = " " $Command1 = "C:\strategy2.ebs" $Command2 = $File_Full_Path & $Space & $Command1 Run($Command2, "", @SW_MAXIMIZE) WinWait(WinGetTitle ( "","")) WinWaitClose(WinGetTitle ( "","")) It only opened the strategy.ebs script rather than running it directly. With the previous autoit script in my first post, it automatically run the ebs script. Also, I tried to call 2 files (as shown above) and it didn't work. The original autoit script in my first post was sent to me from a colleague, and he didn't experience the problem I had. He uses a higher version of ebs script. Thanks very much!!! Link to comment Share on other sites More sharing options...
herewasplato Posted May 20, 2009 Share Posted May 20, 2009 Welcome to the forum. The code that you put in your original post should work. Let's look for why they appear to run out of order. First let me state the obvious - just in case it is not so obvious: Run(... starts the exe that in turn, should run ospan.ebs WinWait(... waits until any window named "E-Run" appears. WinWaitClose(... waits until all windows named "E-Run" to disappear. Run just this portion and see if the AutoIt icon stays in the system tray (down by the clock) until E-Run window closes. Run("C:\Program Files\PST\E-Prime\Program\E-Run.exe /a /m " & '"' & @WorkingDir & '\ospan.ebs"') WinWait("E-Run") WinWaitClose("E-Run") Please post back with the results. [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
sandra Posted May 20, 2009 Author Share Posted May 20, 2009 Thanks so much! Yes, it ran the ospan script and stayed in the system tray until E-Run window closed. I noticed that in the autoit code, & '\ospan.ebs"' has a ' in the front but "' at the end, not the same. Does that matter? Thanks a bunch! Link to comment Share on other sites More sharing options...
herewasplato Posted May 20, 2009 Share Posted May 20, 2009 Thanks so much! Yes, it ran the ospan script and stayed in the system tray until E-Run window closed. I noticed that in the autoit code, & '\ospan.ebs"' has a ' in the front but "' at the end, not the same. Does that matter? Thanks a bunch!Bummer - I had hoped that the icon would flash by. The quotes are okay. Run("C:\Program Files\PST\E-Prime\Program\E-Run.exe /a /m " & '"' & @WorkingDir & '\ospan.ebs"') Well, I had really hoped to not change the code that worked for your colleague, but try this: RunWait("C:\Program Files\PST\E-Prime\Program\E-RunWait.exe /a /m " & '"' & @WorkingDir & '\ospan.ebs"') RunWait("C:\Program Files\PST\E-Prime\Program\E-RunWait.exe /a /m " & '"' & @Workingdir & '\rspan.ebs"') RunWait("C:\Program Files\PST\E-Prime\Program\E-RunWait.exe /a /m " & '"' & @Workingdir & '\paper.ebs"') RunWait("C:\Program Files\PST\E-Prime\Program\E-RunWait.exe /a /m " & '"' & @Workingdir & '\letter.ebs"') RunWait("C:\Program Files\PST\E-Prime\Program\E-RunWait.exe /a /m " & '"' & @Workingdir & '\arithematic.ebs"') Run("C:\Program Files\PST\E-Prime\Program\E-RunWait.exe /a /m " & '"' & @Workingdir & '\categorization.ebs"') [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 20, 2009 Moderators Share Posted May 20, 2009 (edited) Bummer - I had hoped that the icon would flash by. The quotes are okay. Run("C:\Program Files\PST\E-Prime\Program\E-Run.exe /a /m " & '"' & @WorkingDir & '\ospan.ebs"') Well, I had really hoped to not change the code that worked for your colleague, but try this: RunWait("C:\Program Files\PST\E-Prime\Program\E-RunWait.exe /a /m " & '"' & @WorkingDir & '\ospan.ebs"') RunWait("C:\Program Files\PST\E-Prime\Program\E-RunWait.exe /a /m " & '"' & @Workingdir & '\rspan.ebs"') RunWait("C:\Program Files\PST\E-Prime\Program\E-RunWait.exe /a /m " & '"' & @Workingdir & '\paper.ebs"') RunWait("C:\Program Files\PST\E-Prime\Program\E-RunWait.exe /a /m " & '"' & @Workingdir & '\letter.ebs"') RunWait("C:\Program Files\PST\E-Prime\Program\E-RunWait.exe /a /m " & '"' & @Workingdir & '\arithematic.ebs"') Run("C:\Program Files\PST\E-Prime\Program\E-RunWait.exe /a /m " & '"' & @Workingdir & '\categorization.ebs"')The first path should be in double quotes as well, it has a space between Program and Files. Run('"C:\Program Files\PST\E-Prime\Program\E-Run.exe" /a /m "' & @WorkingDir & '\ospan.ebs"') Edit: Or if you're going to use macros:Run('"' & @ProgramFilesDir & '\PST\E-Prime\Program\E-Run.exe" /a /m "' & @WorkingDir & '\ospan.ebs"') Edited May 20, 2009 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
herewasplato Posted May 20, 2009 Share Posted May 20, 2009 Yes I noticed that, but yet it runs.As did everything that I tested before I posted that code:Run("C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe")Run('"C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe"')I also looked in the help file for info about any such change to the Run func.Has something changed or did things with a space always run inside the Run func?I know that the @ComSpec stuff needs the quotes to handle a space in the path, but they do not seem to be needed here??? [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 20, 2009 Moderators Share Posted May 20, 2009 (edited) Yes I noticed that, but yet it runs.As did everything that I tested before I posted that code:Run("C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe")Run('"C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe"')I also looked in the help file for info about any such change to the Run func.Has something changed or did things with a space always run inside the Run func?I know that the @ComSpec stuff needs the quotes to handle a space in the path, but they do not seem to be needed here???I don't know to be honest, I just try to stay conforming with specific functions. And Run is one I always double quote file paths or spaced strings. Edited May 20, 2009 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
wolf9228 Posted May 20, 2009 Share Posted May 20, 2009 Thanks for the help!Sorry I have to bother again to ask stupid questions ( I literally know nothing about programming). I tried the script for dialog application and below is what I used ( I am not sure whether I changed it correctly or not).$File_Full_Path = "c:\Program Files\PST\E-Prime\Program\E-Run.exe" $Space = " "$Command1 = "C:\strategy.ebs"$Command2 = $File_Full_Path & $Space & $Command1Run($Command2, "", @SW_MAXIMIZE)WinWait(WinGetTitle ( "",""))WinWaitClose(WinGetTitle ( "",""))$File_Full_Path = "c:\Program Files\PST\E-Prime\Program\E-Run.exe" $Space = " "$Command1 = "C:\strategy2.ebs"$Command2 = $File_Full_Path & $Space & $Command1Run($Command2, "", @SW_MAXIMIZE)WinWait(WinGetTitle ( "",""))WinWaitClose(WinGetTitle ( "",""))It only opened the strategy.ebs script rather than running it directly. With the previous autoit script in my first post, it automatically run the ebs script. Also, I tried to call 2 files (as shown above) and it didn't work.The original autoit script in my first post was sent to me from a colleague, and he didn't experience the problem I had. He uses a higher version of ebs script.Thanks very much!!!Sorry this is an example Shows the operation actionAnd the difference between two types of ApplicationsWrite The Command Line of this applicationAnd Tell me about The type of applicationI will Help you صرح السماء كان هنا 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