Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: "Lauch App" or "ph_run" Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: May 04 2009 at 22:13 | IP Logged Quote smarty

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 View smarty's Profile Search for other posts by smarty
 
mustangcoupe
Super User
Super User
Avatar

Joined: August 08 2003
Location: United States
Online Status: Offline
Posts: 308
Posted: May 09 2009 at 19:16 | IP Logged Quote mustangcoupe

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 View mustangcoupe's Profile Search for other posts by mustangcoupe Visit mustangcoupe's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: May 14 2009 at 21:55 | IP Logged Quote dhoward

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 View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: May 16 2009 at 17:57 | IP Logged Quote smarty

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 View smarty's Profile Search for other posts by smarty
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum