Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome General
 PowerHome Messageboard : PowerHome General
Subject Topic: PSP’s 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: November 28 2002 at 10:06 | IP Logged Quote TonyNo

Well, I just got done figuring out how to make a web page with a button to play a macro.

After I hit the button, the page goes back to the PH main. How can I stop this?

Thanks,

Tony

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

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: November 28 2002 at 11:10 | IP Logged Quote TonyNo

Here is the code I used (hacked from the html source of the main page)...

<form method="get" action="/ph-cgi/playmacro">
<input type="hidden" name="id" value="TELL WEATHER">
<input type="submit" value="Tell Weather">
</form>

Little snippets like this for other functions would be helpful! For instance, displaying a global variable, or, the status of a device. I tried dissecting some of the samples, but, got lost.

Tony

PS: For some reason, I couldn't edit my last post.

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: November 28 2002 at 19:33 | IP Logged Quote dhoward

Tony,

The playmacro cgi call will always return to the main page.  You can work around this by using the sendkeys call instead.  Check out the code from the sendkeys page.  With the sendkeys call, you can also pass as a parameter what should be the next page to be loaded (which can be the same page that just made the call). 

This Florida boy is visting friends in North Carolina over the holidays and didn't bring his notebook so can't provide more detailed info at this time.  Rest assurred when I get back I'll give you some more details

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: November 30 2002 at 12:01 | IP Logged Quote TonyNo

I got the sendkeys part...

<form method="post" action="/ph-cgi/execsendkeys" name="send_keys">
<input type="hidden" name="sendkeys" value="ph_rtne(ph_macro('TELL TEMP'))">
<input type="hidden" name="nexturl" value="/test2.psp">
<input type="submit" value="Tell Temp-sk">
</form>

"test2.psp" is the file name of the page this is from.

Tony

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

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: December 02 2002 at 11:55 | IP Logged Quote TonyNo

What sort of security is/isn't there with PSP pages?

Tony

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: December 03 2002 at 15:08 | IP Logged Quote dhoward

Tony,

With version 1.02.2, security for PSP pages is controlled within the Web page setup and you can set it to Any, Master or Guest, or Master Only.  The default is Master Only and you would have to be authenticated as the Master user to be able to execute a PSP page.  You can also set it to "Any" and do the authentication manually from within the PSP page by verifying the Base64 authorization and changing the return value.

However, in your above examples, you do not need to use a PSP page.  The send keys code you pasted in your previous post only needs to be a standard HTML file with an extension of ".htm".  The "ph-cgi" internal functions such as the execsendkeys will require the master user password.  You would only need to use PSP if the actual web page itself needed to be dynamic and you were enclosing formula functions within a pair of <% and %> delimiters.

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: December 03 2002 at 17:33 | IP Logged Quote TonyNo

Thanks, Dave!

So, can I look forward to some isolated examples soon of displaying a single global variable, or, the status of a single device?

Tony

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: December 03 2002 at 21:33 | IP Logged Quote dhoward

Hmmm...I did make that promise didn't I ;)

Ok, since the status of an X-10 device or value of a global variable is dynamic, we must use a PSP.

Below is a snippet of code to display the status and level of X-10 device K1:

<%
"Device: K1 Status: " +
case(ph_getx10stat("K",1) when 0 then "Unknown" when 1 then "Off" when 2 then "On") + " " +
"Level: " +
string(round(ph_getx10level("K",1),0))
%>

This code can be pasted anywhere within a PSP page and can be easily modified for the device and output format you would prefer.

Below is a snippet of code to display the value of global variable "SAY SOMETHING":

<%
'Global Variable "SAY SOMETHING" = ' +
ph_getglobal_s("SAY SOMETHING")
%>

Hope this helps and don't hesitate to ask if you have any other questions.

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: December 04 2002 at 00:22 | IP Logged Quote TonyNo

You 'da man!

Tony

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

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: December 07 2002 at 18:57 | IP Logged Quote TonyNo

Okay, here's one. What can anyone see wrong with this...

    <form name="gvadd">
    <input type="text" name="sysvol" maxlength=3 value= <% ph_getglobal_n("SYS VOL") %> size="2">&nbsp;&nbsp;
    <input type="button" value="Set Vol" onclick="gv(4,'SYS VOL', document.gvadd.sysvol.value)">
    </form>
    </td>

I have the gv function defined in a script block in the header, but, when I hit this button, I just get an "Error on page".

I'm close, here!

Tony

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: December 10 2002 at 21:18 | IP Logged Quote dhoward

Tony,

The first problem I see is your ph_getglobal_n("SYS VOL") should be ph_getglobal_s("SYS VOL").  Even though the value stored in the global is a number and you want it interpreted as a number, when you're dynamically creating the HTML, you want it as a string.

That's the only thing I see wrong so far.  If you want to email me the HTML, I can take a look at it and let you know what I find.

PS.  It looks like you're starting to really have some fun with this

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: December 10 2002 at 21:41 | IP Logged Quote TonyNo

Well, I changed the "n" to an "s"... no luck. I sent off the code to you.

Yep! Big fun! Even more later!

Tony

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

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: December 14 2002 at 10:01 | IP Logged Quote TonyNo

Another issue, but, this time, it's HTML related...

Is there any way to vertically center a button in a table? I think I've tried everything.

Tony

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: December 17 2002 at 19:52 | IP Logged Quote dhoward

Tony,

I would think that just valign=center should do it.  I put together a very simple html below which shows that Ive centered a button both vertically and horizontally within a table cell.

<html>
<head>
<title>Test</title>
</head>
<body>
<table border=1>
<tr>
<td>row1 col1</td>
<td>row1 col2</td>
<td>row1 col3</td>
</tr>
<tr>
<td>row2 col1</td>
<form><td rowspan=3 colspan=2 valign=center align=center><input type="button" value="Test"></td></form>
</tr>
<tr>
<td>row3 col1</td>
</tr>
<tr>
<td>row4 col1</td>
</tr>
<tr>
<td>row5 col1</td>
<td>row5 col2</td>
<td>row5 col3</td>
</tr>
</table>
</body>
</html>

Hope this helps,

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: December 17 2002 at 20:43 | IP Logged Quote TonyNo

Ah ha! Any idea why this does not work?

<html>
<head>
<title>Test</title>
</head>
<body>
<table border=1>
<tr>
<td>row1 col1</td>
<td>row1 col2</td>
<td>row1 col3</td>
</tr>
<tr>
<td>row2 col1</td>
<form>
<td rowspan=3 colspan=2 valign=center align=center>
<input type="button" value="Master Bedtime" onclick="macro('MASTER BED')">
</form>
</td>
</form>
</tr>
<tr>
<td>row3 col1</td>
</tr>
<tr>
<td>row4 col1</td>
</tr>
<tr>
<td>row5 col1</td>
<td>row5 col2</td>
<td>row5 col3</td>
</tr>
</table>
</body>
</html>

Tony

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: December 18 2002 at 11:48 | IP Logged Quote dhoward

Tony,

You've got two </form> closing tags...one immediately after the input and one after the </td> closing tag.  Remove the one immediately after the input and leave the one after the </td> tag and it will center.

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: December 18 2002 at 19:31 | IP Logged Quote TonyNo

Okay, I'll give ya that one, but, after fixing it, the button is still not centered vertically. The mystery lives on...

Tony

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: December 19 2002 at 12:05 | IP Logged Quote dhoward

That's strange.  It may have something to do with the browser since each browser has some leeway in interpretation of the HTML.  When I have the closing form tag before the </td> tag, the button is not quite centered.  When I have the closing form tag after the </td> tag, it's centered on my system.  Im running Windows 2K, IE 5.5 SP1.

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: December 19 2002 at 21:36 | IP Logged Quote TonyNo

Okay... That's weird, but it works!

For anyone interested, here's a screenshot of my PSP page so far...

http://members.telocity.com/~tonyno/phqc.gif

As you can see, Weather Underground really updates their site often!

Tony

 

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: December 23 2002 at 14:03 | IP Logged Quote dhoward

Tony,

I like it.  I would also like to ask your permission to place your image onto the PowerHome website on a page which shows what others are doing with PowerHome.

Dave.

 

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

Page of 3 Next >>
  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