Jump to content

How to properly use the Run function? Helpfile doesn't clarify.


Recommended Posts

Why not just do

Run("C:\Soldat\Soldat.exe")

Or, as it is in the other post on this exact same topic

Run($var & "Soldat.exe")
Edited by Hawkwing

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Link to comment
Share on other sites

It does. The first parameter is the path to the executable. That's as explicit as it gets.

It would be good is that's what it actually said in the helpfile, but it does not. It says:

Parameter Description

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

workingdir [optional] The working directory.

It says the filename, not the path to the filename.
Link to comment
Share on other sites

Hello, I'm trying to use the Run function, but the helpfile doesn't clarify how to use the "workingdir" parameter.

I'm trying to do:

Run("Soldat.exe", "C:/Soldat")

But it doesn't work, even though I have Soldat.exe in the directory "C:/Soldat".

Just so you know you had this exactly right, except the problem you are experiencing is the wrong direction for a directory slash \ = operating system directory where as / = web application directory.

Try the following (even though you have working code)

Run("Soldat.exe", "C:\Soldat")

Let me know if that works for you.

Jarvis

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Just so you know you had this exactly right, except the problem you are experiencing is the wrong direction for a directory slash \ = operating system directory where as / = web application directory.

Try the following (even though you have working code)

Run("Soldat.exe", "C:\Soldat")

Let me know if that works for you.

Jarvis

Nope, doesn't work.
Link to comment
Share on other sites

Nope, doesn't work.

It works for me...read below for details.

It would only work if the .exe was in the script folder...

Incorrect. That's what the working directory is for (changes run location).

Edit01: BrettF your statement would only be true with the following code as that would imply the run directory is the working directory.

Run("Soldat.exe")

Please perform the following steps to confirm what I have done.

  • Create Folder "Soldat" on the C:\ Drive
  • Create a script as follows...(Soldat.au3)

    MsgBox(0, "Test", "Success!")
  • Compile that script as Soldat.exe
  • Place that script in C:\Soldat\ directory
  • Write another script in C:\Documents and Settings\Username\My Documents\Personal\AutoIt\SoldatTest.au3

    Run("Soldat.exe", "C:\Soldat")
  • Compile that script as SoldatTest.exe
  • Run it from the AutoIt folder.

Result: Message box showing "Success!" is popped up. My working directory is as stated above.

If anyone can produce different results let me know.

Thanks,

Jarvis

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

I'm just reading v3.3.1.1 (beta) help file and this is fixed there.

Ticket is redundant.

Whoops. I checked the online copy of the help documents, so I didn't know about that.

It works for me...read below for details.

Incorrect. That's what the working directory is for (changes run location).

Edit01: BrettF your statement would only be true with the following code as that would imply the run directory is the working directory.

Run("Soldat.exe")

Please perform the following steps to confirm what I have done.

  • Create Folder "Soldat" on the C:\ Drive
  • Create a script as follows...(Soldat.au3)

    MsgBox(0, "Test", "Success!")
  • Compile that script as Soldat.exe
  • Place that script in C:\Soldat\ directory
  • Write another script in C:\Documents and Settings\Username\My Documents\Personal\AutoIt\SoldatTest.au3

    Run("Soldat.exe", "C:\Soldat")
  • Compile that script as SoldatTest.exe
  • Run it from the AutoIt folder.

Result: Message box showing "Success!" is popped up. My working directory is as stated above.

If anyone can produce different results let me know.

Thanks,

Jarvis

I'm surprised that works. The working directory has nothing to do with the list of directories used to find an executable.
Link to comment
Share on other sites

I've always thought that the working folder doesn't need to be the same as the exe folder. >_<

The exe can be in c:\program files\myprog\myprog.exe

Myprog.exe can have a file open in c:\test.

Isn't (in my example) the working folder c:\test ?

If you learn from It, it's not a mistake

Link to comment
Share on other sites

Well I am happy I could surprise! >_<

I know that Soldat.exe isn't in the %PATH% environment variable, and because it's outside my running directory, I had to specify the working directory so AutoIt would know where to find it.

Regards,

Jarvis

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

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