Sign in to follow this  
Followers 0
sandra

Please help!

13 posts in this topic

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

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by wolf9228

صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 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.

Share this post


Link to post
Share on other sites

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!!!

Share this post


Link to post
Share on other sites

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]

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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]

Share this post


Link to post
Share on other sites

#10 ·  Posted (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 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.

Share this post


Link to post
Share on other sites

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]

Share this post


Link to post
Share on other sites

#12 ·  Posted (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 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.

Share this post


Link to post
Share on other sites

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!!!

Sorry this is an example Shows the operation action

And the difference between two types of Applications

Write The Command Line of this application

And Tell me about The type of application

I will Help you :)


صرح السماء كان هنا

 

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