Jump to content

Running an application using the run command


vickerps
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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

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