Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Updated PSP Code Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: January 08 2008 at 20:54 | IP Logged Quote TonyNo

Since we have so many nifty new ways of doing things, I'd like to know what the current best method is for evaluating formulas.

I have been using the JavaScript SK function from long ago...

Code:
function sk(value)
{ document.execsendkeys.sendkeys.value = value; document.execsendkeys.submit(); }


Then I call it with something like this in a button...

Code:
onclick="sk('ph_rtne( ph_insteon( \'OUTSIDE HOLIDAY\', ifastoff, 0 ))')"


I'm pretty sure there is a better way these days.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: January 15 2008 at 17:31 | IP Logged Quote dhoward

Tony,

There are indeed several new ph-cgi functions (I see another post coming soon documenting these ) but to just execute a standard PowerHome formula, the preferred method would be with a /ph-cgi/evalformula function. It works exactly like the execsendkeys function but does not require the ph_rtne function to make sure that keystrokes are not generated.

So, the missing part would be an HTML form probably called evalformula rather than execsendkeys. The action of this form would be /ph-cgi/evalformula. The parameter required would also need to be changed from "sendkeys" to formula. With that in place your sk function would look like this:

Code:
function sk(value)
{document.evalformula.formula.value = value; document.evalformula.submit();}


and then call it like this:

Code:
onclick="sk('ph_insteon(\'OUTSIDE HOLIDAY\',ifastoff,0)')"


All in all, not much simpler, but definately the preferred way since we're not actually trying to send keystrokes.

HTH,

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

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: January 15 2008 at 19:16 | IP Logged Quote TonyNo

Cool. Thanks. Eliminating one level of quotes means a lot!
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo'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