Sign in to follow this  
Followers 0

Running an application using the run command

8 posts in this topic

#1 ·  Posted

Anyone help i am having problem kicking of an application using the Run() command.

I have a script that look at a supplied list of the programs then sequentually they get passed through the a run() which intern kicks them off

However one of the programs in the list doesn't work properly unless i provide the working directory as well (I don't want to do this)

However i run the program through the run bar in window xp or even a simple bat file and the program works perfectly. Is there a command that mimicks this?

Share this post


Link to post
Share on other sites



#2 ·  Posted

Have you tried ShellExecute()? I don't have any idea if that will work differently...


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

#3 ·  Posted

Anyone help i am having problem kicking of an application using the Run() command.

I have a script that look at a supplied list of the programs then sequentually they get passed through the a run() which intern kicks them off

However one of the programs in the list doesn't work properly unless i provide the working directory as well (I don't want to do this)

However i run the program through the run bar in window xp or even a simple bat file and the program works perfectly. Is there a command that mimicks this?

Might be worth trying to change the working directory to th eexe directory befor eusing Run.

FileChangeDir($exeDir)


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

#4 ·  Posted

Might be worth trying to change the working directory to th eexe directory befor eusing Run.

FileChangeDir($exeDir)

First of thanks for the replies. I tried ShellExecute() but still has the same problem. Does no one know of a way that autoit can mimick exactly what a run line or bat file would do. Does windows setup the working directory for all programs launch it self and if so what does windows set the working dir too?

Share this post


Link to post
Share on other sites

#5 ·  Posted

Might be worth trying to change the working directory to th eexe directory befor eusing Run.

FileChangeDir($exeDir)

First of thanks for the replies. I tried ShellExecute() but still has the same problem. Does no one know of a way that autoit can mimick exactly what a run line or bat file would do. Does windows setup the working directory for all programs launch it self and if so what does windows set the working dir too?

Share this post


Link to post
Share on other sites

#6 ·  Posted

First of thanks for the replies. I tried ShellExecute() but still has the same problem.

Did you try the FileChangeDir?

Does no one know of a way that autoit can mimick exactly what a run line or bat file would do. Does windows setup the working directory for all programs launch it self and if so what does windows set the working dir too?

As far as I know if you change the working directory to the same folder as you would use the command line from and then use Run it will be the same as using the command line. If you find it isn't then can you show what you are tryting to do?

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

#7 ·  Posted (edited)

Did you try the FileChangeDir?

As far as I know if you change the working directory to the same folder as you would use the command line from and then use Run it will be the same as using the command line. If you find it isn't then can you show what you are tryting to do?

Hi Martin

Sorry i'm obviously having a dumb day because i don't understand what your saying. I hope this is what you mean.

I have a few program that i need to run called wormhole.exe this little app look to where it being run from for dll and what not. If i run this from

a bat file = works fine

From window run line =works fine

Autoit Run(c:\wormhole\wormhole.exe,"c:\wormhole\",@sw_hide) = works fine

Autoit Run(@ComSpec & " /c " & 'c:\wormhole\wormhole.exe',"c:\wormhole\",@sw_hide) = works fine

Autoit Run(c:\wormhole\wormhole.exe,"",@sw_hide) = doesn't work

Autoit Run(@ComSpec & " /c " & 'c:\wormhole\wormhole.exe',"",@sw_hide) = doesn't work

My Problem is i need a way for autoit to use the working directory of the program being run?

Edited by vickerps

Share this post


Link to post
Share on other sites

#8 ·  Posted

Hi Martin

Sorry i'm obviously having a dumb day because i don't understand what your saying. I hope this is what you mean.

I have a few program that i need to run called wormhole.exe this little app look to where it being run from for dll and what not. If i run this from

a bat file = works fine

From window run line =works fine

Autoit Run(c:\wormhole\wormhole.exe,"c:\wormhole\",@sw_hide) = works fine

Autoit Run(@ComSpec & " /c " & 'c:\wormhole\wormhole.exe',"c:\wormhole\",@sw_hide) = works fine

Autoit Run(c:\wormhole\wormhole.exe,"",@sw_hide) = doesn't work

Autoit Run(@ComSpec & " /c " & 'c:\wormhole\wormhole.exe',"",@sw_hide) = doesn't work

My Problem is i need a way for autoit to use the working directory of the program being run?

Would this do what you want?

$prog = "c:\wormhole\wormhole.exe";set vto the full path for the program to run
$progDir = Stringleft($prog,StringInStr($Prog,'\',0,-1));extract the containing folder
ConsoleWrite($progDir & @CRLF)

Run($prog,$progDir,@sw_hide)

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  
Followers 0