Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Previous section Next section Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Topic:
Pronto script for power tracking (or other types of tracking)
This thread has 6 replies. Displaying all posts.
Post 1 made on Thursday July 1, 2010 at 13:00
Jimmy Bellagio
Advanced Member
Joined:
Posts:
January 2008
854
Hello, I am wondering if someone would be willing to share a script with a beginner to Prontoscript. I am trying to learn, my needs exceed my learning curve. Would love to see a specific PS in action tailored to my problem so I can learn better.

Here is the situation - I want to be able to have a buton called "Run this activity". When you press run this activity it does the following:

Jump to please wait screen
Turns on Projector
Turns on Receiver

If variable PROJPOWER = TRUE */ checks to see if variable is TRUE
then do nothing */
else delay 30 seconds */
set variable PROJPOWER = TRUE */

Set Projector input to component 1
Jump to Activity Page

As you can see from my example, this button will perform a 30 second delay the first time it is pressed and continue on without delay every other time or until the variable is set to FALSE.

Can anyone share a script that will do the above button along with a button that will set the variable to FALSE? Would greatly appreciate any help. I know this may be super simple for the PS gurus but it will really be helping me understand PS for my most basic need. Thanks in advance.

James
James S. Bellagio
Post 2 made on Thursday July 1, 2010 at 13:24
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,996
Jimmy,

The example I am posting below will work and I use something very similar in my own setup. The example in the Dev Guide section 8.3.1 is pretty much identical to this except that instead of setting a label on a widget, I am simply executing actions on one of two widgets based on true/false being reported by power sense input.

Assumption is that you are running latest firmware which supports scheduleActions() on a widget. If not search this forum for executeActions() and find an example I have posted about wrapping it with try/catch.

Set up most of it like you would do regularly (using delays and a set of progress bar pages).

Next
Create 2 buttons on a hidden page in Home activity 'PROJ_STARTUP' is assigned as the ProntoScript name.

Button #1 (assign ProntoScript name of 'PROJ_OFF') - add actions to Power on projector, Jump through your progress pages (includes 30 second delay), and then jump to final page.

Button #2 (assign ProntoScript name of 'PROJ_ON') - add action to Jump directly to your final page.

Then, in the button on your home page (ProntoScript must be invoked from starting button, assuming extender #0 and Power Sense Port #1 add the following script.

var ext = CF.extender[0]; // Extender 0
var input = ext.input[0]; // Power Sense #1
var wTag;
try
{
// input.get() can raise an error. I have not built retry logic in here.
// I leave this as an exercise for the user.

// I use short-hand if clauses frequently. If you prefer longer form, simply use:
// if (input.get())
// wTag = 'PROJ_ON';
// else
// wTag = 'PROJ_OFF';
wTag = input.get() ? 'PROJ_ON' : 'PROJ_OFF';
}
catch(e)
{
// assume projector is off if input state retrieval fails (extender is busy).
wTag = 'PROJ_OFF';
}
// if hidden page with buttons not in current activity, specify prontoscript name
// of the activity that contains the hidden page as 3rd parameter.
w = CF.widget(wTag, 'PROJ_STARTUP');
if (w)
w.scheduleActions();

Last edited by Lyndel McGee on July 1, 2010 17:04.
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 3 made on Thursday July 1, 2010 at 13:30
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,996
If you don't want to use Power Sense, use


System.setGlobal('PROJ_STATUS','ON');


In the page script of last Progress bar page.

Then, when you turn off the system, just make sure you clear that flag with:


System.setGlobal('PROJ_STATUS',null);


You can do this via button script or via page script of an intermediate page you jump to when system is shutting down.

For example, in your System Off button, add the ProntoScript:


System.setGlobal('PROJ_STATUS',null);
this.executeActions();


In the button script I posted before, change the line:

wTag = input.get() ? 'PROJ_ON' : 'PROJ_OFF';

to:

wTag = (System.getGlobal('PROJ_STATUS') === 'true') ? 'PROJ_ON' : 'PROJ_OFF';

Last edited by Lyndel McGee on July 1, 2010 17:07.
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 4 made on Thursday July 1, 2010 at 14:30
Jimmy Bellagio
Advanced Member
Joined:
Posts:
January 2008
854
WOw, thank you so much Lyndel for all this information. A power sensor is not an option in most cases due to wiring issues. Let me run with this and I will report back with the results.

Thanks again,
James
James S. Bellagio
Post 5 made on Thursday July 1, 2010 at 17:06
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,996
Note some minor changes to script above so if you have copied, check above for changes as there were a couple of syntax errors in a commented block.
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 6 made on Thursday July 1, 2010 at 17:10
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,996
Note that my MITS DLP tv does not properly trigger a Xantech power sense unit so I resorted to using System.setGlobal() for my TV and Power Sense for my Denon receiver.

My actual setup looks at both the Global and the Power Sense and calculates via bitwise operations, a value between 0 and 3, based upon which value, I execute 1 of 4 different macros.

0 = Both Off // Do 2 progress bar sequences powering on TV followed by Receiver.
1 = TV Off, Receiver On - Do single progress bar sequence for TV.
2 = TV On, Receiver Off - Do single progress bar sequence for Receiver.
3 = TV On, Receiver On - Simply jump to final page.
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 7 made on Saturday July 3, 2010 at 00:38
buzz
Super Member
Joined:
Posts:
May 2003
4,376
I'm not comfortable with macros that require 25 seconds to execute -- especially if the user is expected to hold the remote in place until that last IR command is emitted.

I strongly suggest that customers opt for the RF mode. Even though the TV could use direct IR, I stick an emitter on it. At that point, there is no aiming and one could turn OFF a room from another room. Long macros are not as much of an issue in an RF setup.

Perhaps the GlobalCache WF2IR can help. This unit can sense levels and emit IR.


Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse