Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: How to Gracefully Exit PH 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 13 2009 at 19:49 | IP Logged Quote smarty

I am working on some macro's and .cmd files (vista batch files) to power-up and power-down my system based upon what my UPS senses for house power.

Presently I am stuck on how to gracefully exit PowerHome after my PowerHome "shutdown" macro executes.

From within Powerhome, I have tried:
ph_closewindow(ph_handle())
and
ph_sendkeys("{exit}")
both of which seem to hang (I guess because they were initiated from within what I am trying to shutdown).

Does anyone have any ideas of how I can shut PH down programatically either from within or outside of PH?

In the PH ini file, and have already turned off the setting that asks for confirmation on exit.

Edited by smarty - May 13 2009 at 19:50


__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
dhoward
Admin Group
Admin Group
Avatar

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

Smarty,

Try
Code:
ph_postformula("ph_closewindow(ph_handle())")


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 15 2009 at 08:52 | IP Logged Quote smarty

OK, Still no luck....

Maybe I am testing this wrong....

I make a one line formula macro, using one of the formula's suggested above (I have tried this with the "value" column both posted or immediate). When I run the macro, the PH window doesn't close, but rather it freezes, and I have to end up forcing the window to close by using the "end now" Windows function.

There should be a way to programaticly (sp?) gracefully exit PH from within (or at least from an external bat/cmd file)....right?

Edited for bad spelling!!

Edited by smarty - May 15 2009 at 08:55


__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
dhoward
Admin Group
Admin Group
Avatar

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

Hmmmm...I just tried this myself and was able to do it successfully. I created a one line macro that looks like this:

10 Formula Post ph_closewindow(ph_handle())

Saved, and executed right from the macro screen of the PH Explorer. No lockups.

One other thing I might mention...you CANT close PowerHome if you're running it as a service using these methods. Services must be closed a different way. I would have to check the exact syntax, but to close PH when its running as a service would require something like:

ph_run("c:\program files\powerhome\phservice.exe -k PowerHome")

I just checked the above and this does work.

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 15 2009 at 14:29 | IP Logged Quote smarty

I am not running PH as a service, so

Hmmm....
I turned the MacAfee service off and it STILL does not exit gracefully (not at home and also not at work).

I am trying to think of common running programs or services between work and home (MacAfeee was one) that might cause PH not to exit properly.

....Er....help????

__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
smarty
Super User
Super User
Avatar

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

OK, I think I figured it out....

Initially I stated.... "In the PH ini file, I have have already turned off the setting that asks for confirmation on exit."

I turned the EXIT confirmation back on, but then I set the confirmshutdowndefault to YES, and now I can exit exit gracefully.

See below:

[System]
CONFIRMSHUTDOWN=yes
ConfirmShutdownDefault=yes

If I turn the EXIT confirmation OFF, PowerHome hangs no matter what I set the conformationshutdowndeafult to be.
A slight bug?


Edited by smarty - May 16 2009 at 17:52


__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: May 25 2009 at 11:26 | IP Logged Quote dhoward

Smarty,

I'll check this out and let you know what I find.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 

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