Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Running an application using the run command


  • Please log in to reply
7 replies to this topic

#1 vickerps

vickerps

    Prodigy

  • Active Members
  • PipPipPip
  • 175 posts

Posted 23 September 2008 - 03:12 PM

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?







#2 Achilles

Achilles

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 2,897 posts

Posted 23 September 2008 - 04:10 PM

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

#3 martin

martin

    ~~\o/~~~/0\=¬''~~~

  • MVPs
  • 7,315 posts

Posted 23 September 2008 - 06:56 PM

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.

#4 vickerps

vickerps

    Prodigy

  • Active Members
  • PipPipPip
  • 175 posts

Posted 24 September 2008 - 01:44 PM

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?

#5 vickerps

vickerps

    Prodigy

  • Active Members
  • PipPipPip
  • 175 posts

Posted 24 September 2008 - 01:45 PM

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?

#6 martin

martin

    ~~\o/~~~/0\=¬''~~~

  • MVPs
  • 7,315 posts

Posted 25 September 2008 - 11:48 AM

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.

#7 vickerps

vickerps

    Prodigy

  • Active Members
  • PipPipPip
  • 175 posts

Posted 26 September 2008 - 03:19 PM

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, 26 September 2008 - 03:20 PM.


#8 martin

martin

    ~~\o/~~~/0\=¬''~~~

  • MVPs
  • 7,315 posts

Posted 26 September 2008 - 04:20 PM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users