Jump to content

Question using Run


Guest Guest_gasman
 Share

Recommended Posts

Guest Guest_gasman

When I run my script testit.au3

The following statement works.

$prog_dir= "C:\Progra~1\Wildli~1\WC-GPE\"

RunWait(@comSpec & " /c " & $prog_dir & "XX-ACP.1.01.2004.exe", "",@SW_HIDE);

It launches the program XX-ACP.1.01.2004.exe just fine.

If I comment out that line and put this one under it...

Run("XX-ACP.1.01.2004.exe", $prog_dir)

I get an error which says it can not find the file. There are no typing errors here!

Bug?

Any idea what might be going on?

-g

Link to comment
Share on other sites

I'm not sure if this will work or not, but how about removing the trailing backslash when you want to use the 2nd paramater of Run (the working directory) ? Maybe it will do something different. If not, you might want to post this in the bugs forum.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to comment
Share on other sites

Guest Guest

Trailing slash or no trailing slash it doesn't work.

Any other ideas how to launch this program so I can continue to use the script?

-g

Link to comment
Share on other sites

When I run my script testit.au3

The following statement works.

$prog_dir= "C:\Progra~1\Wildli~1\WC-GPE\"

RunWait(@comSpec & " /c " &  $prog_dir & "XX-ACP.1.01.2004.exe", "",@SW_HIDE);

It launches the program XX-ACP.1.01.2004.exe just fine.

If I comment out that line and put this one under it...

Run("XX-ACP.1.01.2004.exe", $prog_dir)

I get an error which says it can not find the file.  There are no typing errors here!

Bug?

Any idea what might be going on?

-g

The command is probably in the path which is why it works with @comspec

You may need to specify the path of the command without @comspec

Rick

Link to comment
Share on other sites

Guest Guest

I'll give that a shot, thanks.

However, I did discover that this work! Praise the Saints!!!

Run("C:\Progra~1\Wildli~1\WC-GPE\XX-AMP.1.01.2004.exe")

without bothering with the directory parameter.

... which leads me to believe either the documentation needs updating in terms of how to actually use Run, or there is a bug.

-g

Link to comment
Share on other sites

Guest gasman

In fact, this works as well?

Run($prog_dir & "XX-AMP.1.01.2004.exe)

.... which isn't exactly the way it is described in the help.

-g

Link to comment
Share on other sites

Guest gasman

It isn't that I'm specifying the path.... the documentation suggests the command format should be:

Run(program,path)

My experiences suggest that doesn't work!

However these forms did:

Run($path & $program)

Run("/directory_path/program")

However, they aren't exactly working as they should, but they do launch the program.

-g

Link to comment
Share on other sites

  • Developers

the helpfile says:

Run ( "filename" [, "workingdir" [, flag]] )

Parameters

filename - The name of the executable (EXE, BAT, COM, or PIF) to run.

workingdir [optional] The working directory.

flag [optional] The "show" flag of the executed program:

  @SW_HIDE = Hidden window

  @SW_MINIMIZE = Minimized window

  @SW_MAXIMIZE = Maximized window

So the Path parameter is the working dir.

I think it is a good suggestion that the Helpfile should say something like:

"filename - The full path\name of the executable (EXE, BAT, COM, or PIF) to run."

Because this seems to be a constant returning question....

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Looking at the doc, the syntax for Run is:

Run( "filename" [, "workingdir" [, flag]] )

I think that the second parm (workingdir) is the initial directory where you want your application (1st parm) to look at if it needs to open/create a file (when not using a fully qualified path for the file). When I use Run/RunWait, I always fully qualify the path of my executable in parm 1.

=MX=

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...