Sign in to follow this  
Followers 0
Guest Guest_gasman

Question using Run

12 posts in this topic

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

Share this post


Link to post
Share on other sites



better of without cmd

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Run("c:\windows\notepad.exe","", @SW_MINIMIZE)
Run("notepad.exe", "c:\windows", @SW_MINIMIZE)
Run("notepad.exe", "c:\windows\", @SW_MINIMIZE)

I just tried these 3 ways. All worked

arctor

Share this post


Link to post
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


Only $2.00 with Resale Rights How to Block Better for Martial Artists and NonMartial Artistshttp://kirkhamsebooks.com/MartialArts/Bloc...tterEbook_m.htm

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Each time you've specified the path of the exe

It works great job

Rick


Only $2.00 with Resale Rights How to Block Better for Martial Artists and NonMartial Artistshttp://kirkhamsebooks.com/MartialArts/Bloc...tterEbook_m.htm

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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=

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