Jump to content
Sign in to follow this  
ARozanski

Run workingdir

Recommended Posts

ARozanski

I created a GUI that had a launch button with the simple task of running another .exe program. It did not work until i added the [optional] working directory. I would just like to know why? what is the workingdir for and how it made a difference...

thanks alot in advance

Share this post


Link to post
Share on other sites
martin

I created a GUI that had a launch button with the simple task of running another .exe program. It did not work until i added the [optional] working directory. I would just like to know why? what is the workingdir for and how it made a difference...

thanks alot in advance

If you used @WorkingDir for the working directory then I would not have expected it to make any difference, but if you used the explicit path then it could well make a difference. If you started your script using a shortcut for example, the working directory might not be the folder where the script is stored.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
ARozanski

I have no idea what you just said - the program i wanted to run was not a shortcut and i didn't use @WorkingDir - i used the actual directory where the .exe was stored in....eg

the file is named example.exe and its stored in program files

Run("C:\Program Files\example.exe","C:\Program Files")

the first time i tried without adding the directory it did not work...

i am very new to AutoIt so im sorry if i dont understand

Thanks again

Share this post


Link to post
Share on other sites
martin

I have no idea what you just said - the program i wanted to run was not a shortcut and i didn't use @WorkingDir - i used the actual directory where the .exe was stored in....eg

the file is named example.exe and its stored in program files

Run("C:\Program Files\example.exe","C:\Program Files")

the first time i tried without adding the directory it did not work...

i am very new to AutoIt so im sorry if i dont understand

Thanks again

There is a macro in AutoIt @WorkingDir. It is a read-only variable which gives the working dir. If your Run didn't work until you added the working directory, then the working directory must have been some other folder. If you add the line

MsgBox(262144,"working dir is",@WorkingDir)

befor your run statement then you will see why your script didn't work.

The shortcut I mentioned was a shortcut to run your script not the program which the script has to run. If you look at the properties of a shortcut y9u will see that the working directory can be set and it need not be the same as the target folder.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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  

×