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: February 02 2003 at 12:00 | IP Logged Quote TonyNo

Can you spot what I've got wrong, here?

<form method="get" action="macro(id.value);">Macro:
<select name="id" size=1>
<option value="">
<option value="AMP OFF">AMP OFF
<option value="AMP ON">AMP ON
<option value="BYE">BYE
</select>
<input type="submit" value="Play">
</form>

I'm also looking for a way to do dimming with a drop-down list.

Thanks - 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: February 03 2003 at 14:10 | IP Logged Quote dhoward

Tony,

Your action of "macro(id.value)" is not correct.  The action for a form must be a new webpage.  I think what you may have been trying to do is: "/ph-cgi/playmacro".  This is still not what you would want however because the next webpage loaded by the "playmacro" would be the main page.  You could probably accomplish what you want to do with:

<form method="post" action="ph-cgi/execsendkeys">Macro:
<select name="sendkeys" size=1>
<option value="ph_rtne(0)">
<option value="ph_rtne(ph_macro('AMP OFF'))">AMP OFF
<option value="ph_rtne(ph_macro('AMP ON'))">AMP ON
<option value="ph_rtne(ph_macro('BYE'))">BYE
</select>
<input type="submit" value="Play">
<input type="hidden" name="nexturl" value="whatever this page is">
</form>

Now if you wanted to get a little fancier, you could use something like the code below so that the page doesn't have to refresh everytime.

<html>
<head>
<title>PowerHome</title>
<script language="JavaScript">
<!--
function openskwin()
{
 var skwin;
 skwin=window.open('about:blank','SKWin','width=100,height=100,location=no,menubar=no,titlebar=no,status=no,toolbar=no,scrollbars=no,resizable=no,top=100,left=100',true);
 skwin.blur();
}
// -->
</script>
<body onload="openskwin()">
<form name="Form1" method="post" target="SKWin" action="ph-cgi/execsendkeys">Macro:
<select name="sendkeys" size=1>
<option value="ph_rtne(0)">
<option value="ph_rtne(ph_macro('AMP OFF'))">AMP OFF
<option value="ph_rtne(ph_macro('AMP ON'))">AMP ON
<option value="ph_rtne(ph_macro('BYE'))">BYE
</select>
<input type="hidden" name="nexturl" value="about:blank">
<input type="button" value="Play" onclick="document.Form1.submit();self.focus();">
</form>

Dimming and brightening would be accomplished in a similar manner such as outlined below:

<html>
<head>
<title>PowerHome</title>
<script language="JavaScript">
<!--
function openskwin()
{
 var skwin;
 skwin=window.open('about:blank','SKWin','width=100,height=100,location=no,menubar=no,titlebar=no,status=no,toolbar=no,scrollbars=no,resizable=no,top=100,left=100',true);
 skwin.blur();
}
// -->
</script>
<body onload="openskwin()">
<form name="Form1" method="post" target="SKWin" action="ph-cgi/execsendkeys">A1 Level:
<select name="sendkeys" size=1>
<option value="ph_rtne(0)">
<option value="ph_rtne(ph_x10(1,'A',1,0) + ph_x10(1,'A',105,100))">100%
<option value="ph_rtne(ph_x10(1,'A',1,0) + if(ph_getx10level('A',1) > 75,ph_x10(1,'A',104,ph_getx10level('A',1) - 75),ph_x10(1,'A',105,75 - ph_getx10level('A',1))))">75%
<option value="ph_rtne(ph_x10(1,'A',1,0) + if(ph_getx10level('A',1) > 50,ph_x10(1,'A',104,ph_getx10level('A',1) - 50),ph_x10(1,'A',105,50 - ph_getx10level('A',1))))">50%
<option value="ph_rtne(ph_x10(1,'A',1,0) + if(ph_getx10level('A',1) > 25,ph_x10(1,'A',104,ph_getx10level('A',1) - 25),ph_x10(1,'A',105,25 - ph_getx10level('A',1))))">25%
</select>
<input type="hidden" name="nexturl" value="about:blank">
<input type="button" value="Set Level" onclick="document.Form1.submit();self.focus();">
</form>
</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: February 03 2003 at 16:25 | IP Logged Quote TonyNo

Holy cow!

I was just looking for a way to put proper macro names in a list and pass on the selected one to be executed. Same with the dim values (i.e. 0 to 100 in steps of 10). Can either of these be done?

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: February 04 2003 at 15:15 | IP Logged Quote dhoward

Tony,

Still not exactly sure what you're looking for, but here's another stab at it :

<html>
<head>
<script language="JavaScript">
<!--
function playmacro(value)
{
 document.sk.sendkeys.value = "ph_rtne(ph_macro('" + value + "'))";
 document.sk.submit();
}
// -->
</script>
</head>
<body>
<form method="post" action="ph-cgi/execsendkeys" name="sk">
<input type="hidden" name="sendkeys" value="">
<input type="hidden" name="nexturl" value="/thispagesfilename.htm">
</form>

<form name="macro1">Macro:
<select name="id" size=1>
<option value="">
<option value="AMP OFF">AMP OFF
<option value="AMP ON">AMP ON
<option value="BYE">BYE
</select>
<input type="button" value="Play" onclick=playmacro(document.macro1.id.value)>
</form>

</body>
</html>

This is a complete working HTML file.  It uses a hidden form to perform the desired action and allows you to pass the macro name to a javascript function which will build the appropriate sendkeys formula and submit the hidden form.

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: February 04 2003 at 20:34 | IP Logged Quote TonyNo

You'd be proud!

I looked at your code and folded it into my code (I already had a macro function defined that you gave me last time )...

function macro(id)
{ document.execsendkeys.sendkeys.value = "ph_rtne(ph_macro('" + id.toUpperCase() + "'))";  document.execsendkeys.submit(); }

I only had...

<form name="macro1">

...and was missing...

onclick=macro(document.macro1.id.value)

...wrong.

I'll give the dimming one a shot...

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: February 05 2003 at 07:02 | IP Logged Quote TonyNo

Okay, here goes!

First, I created a function...

function dim(hc, uc, value)
{ document.execsendkeys.sendkeys.value = "ph_rtne(ph_x10btn('" + hc.toUpperCase() + "','" + uc + "',100, '" + value + "'))"; document.execsendkeys.submit(); }

Then, in my page, I do this...

<form name="dim1">
<select name="id" size=1>
<option value="">
<option value="100">100%
<option value="50">50%
</select>
<input type="button" value="ADim" onclick="dim('a', 8, document.dim1.id.value)">
</form>

No luck! I think I'm close!

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: February 07 2003 at 10:59 | IP Logged Quote dhoward

Tony,

Real close ...take the single quotes out surrounding the uc and you should be ok.  The housecode needs to be in quotes, the unitcode and command without quotes, and the value with quotes.

NOTE:  This is changing in the next version.  There is a slight enhancement to the ph_x10btn function where if the device supports extended commands, it will generate the X-10 commands using extended dims.  Part of this change is that the "Dim" value will be passed as an integer and will need to be passed "without" quotes in the next release.

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: February 07 2003 at 20:45 | IP Logged Quote TonyNo

Close, but no cigar! Changed it, but, there is still an error (only when I click the button, though). The error is "document.execsendkeys.sendkeys is null or not an object". Any more ideas?

I'll e-mail you the file and maybe you can eyeball it?  

Thanks - 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: February 07 2003 at 20:59 | IP Logged Quote dhoward

Tony,

I assumed that you also had the following code below in your html but maybe Im wrong:

<form method="post" action="ph-cgi/execsendkeys" name="execsendkeys">
<input type="hidden" name="sendkeys" value="">
<input type="hidden" name="nexturl" value="/thispagesfilename.htm">
</form>

This is the hidden form named "execsendkeys" that your "dim" function is trying to update and submit.

Hope this helps .

If this isn't it, go ahead and email it and give it a once over.

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: February 08 2003 at 11:05 | IP Logged Quote TonyNo

All better!  The bad thing is, it looks like the dimming drop-down needs a unique name for each use! I think I'll try to condense all the dims into one line, and, add a drop-down for the device to eliminate that.

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: February 08 2003 at 12:04 | IP Logged Quote TonyNo

Harumph! Is there a way to create a drop-down and assign multiple variables per item?

Another option would be to do this...

<option value="A8">Table Lamp

...and then, somehow, parse out the house code and unit code for the dim function.

I could also create a macro in PH that gets the "A8" and deals with it in there.

Thoughts?

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: February 08 2003 at 17:57 | IP Logged Quote TonyNo

Ah ha! I created the macro, and, it is getting and parsing the data just fine... I just can't get the command to execute. How do I get ph_xxx functions to work in a PH macro again?

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: February 08 2003 at 19:44 | IP Logged Quote TonyNo

Well, this does not even work...

Set System | [TEMP1] | ph_rtne( ph_x10btn( "A", 8, 100, 50))

What sort of forest am I missing 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: February 08 2003 at 21:26 | IP Logged Quote dhoward

Tony,

To just execute the ph_ xxx functions, just use the macro command "Formula".  You won't even need the ph_rtne.  You can also use the "Send Keys" command, but you'll need the ph_rtne.

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: February 08 2003 at 22:28 | IP Logged Quote TonyNo

I just noticed that the dim value is a string!

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: February 08 2003 at 23:35 | IP Logged Quote TonyNo

For anyone interested, here is a description of my solution...

http://home.earthlink.net/~tonyno/powerhome_dropdown_dimming.htm

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: February 10 2003 at 09:29 | IP Logged Quote dhoward

Excellent Tony!!

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: February 10 2003 at 11:54 | IP Logged Quote TonyNo

Aw, thanks, Dave!

Tony

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

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