Author |
|
smarty Super User
Joined: May 21 2006 Location: United States
Online Status: Offline Posts: 728
|
Posted: May 04 2009 at 22:13 | IP Logged
|
|
|
When using either option above, I am having problems lauching the program "c:\program files\xlobby\xlobby2.exe". I get a Windows Error Report.
When I launch the program by writing a small batch file from a DOS window, I find that I first have to set the working directory to "c:\program files\xlobby", and then execute "xlobby2.exe" from that location (no error when I do this).
So, my question is, how do I set the working directory to "C:\program files\xlobby" so that I can run one of the above commands?
Is there a command line switch that I should be using with ph_run("c:\program files\xlobby\xlobby2.exe") ?
Edited by smarty - May 05 2009 at 10:43
__________________ Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
|
Back to Top |
|
|
mustangcoupe Super User
Joined: August 08 2003 Location: United States
Online Status: Offline Posts: 308
|
Posted: May 09 2009 at 19:16 | IP Logged
|
|
|
looks like my 1st reply was eaten by the server... but
I just ran ph_run("C:\Program Files\Internet Explorer\iexplore.exe") from a macro no problem, check your directories, and maybe add additional ' ' around the file as windows may need to see quotes around the file as it has a space in it.
maybe
ph_run('"c:\program files\xlobby\xlobby2.exe"')
or
ph_run("'c:\program files\xlobby\xlobby2.exe'")
__________________ Todd Hannemann
HA newbie
PowerHome - UPB - ELK
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: May 14 2009 at 21:55 | IP Logged
|
|
|
Smarty,
Unfortunately, there is no way to specify the working directory when launching an executable. This seems to be a real flaw with the Windows execute command. As you've discovered, you can work around it by executing a batch file that sets the directory and then launches the executable.
However, the more "Windows" way would be to create a shortcut (which allows you to specify the working directory) and then launching that. It took quite a bit of playing around but I finally figured out how to do it from within PH. Below is a sample ph_run command that launches a shortcut.
Code:
ph_run('cmd /c "C:\Documents and Settings\All Users\Desktop\Notepad.lnk"') |
|
|
You may have to adjust this for the location of your shortcut and of course the shortcut name. The only "messy" thing about this is that it quickly opens and closes a command window in order to launch the shortcut. Ugly but still better in my opinion than having alot of batch files.
HTH,
Dave.
|
Back to Top |
|
|
smarty Super User
Joined: May 21 2006 Location: United States
Online Status: Offline Posts: 728
|
Posted: May 16 2009 at 17:57 | IP Logged
|
|
|
Thanks Dave.
Your support is GREATLY appreciated. It seems that periodically I run into some things that are challenging (for me), but with PH and your support, It all seems to eventually work out just fine! THANKS!!!
__________________ Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
|
Back to Top |
|
|