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:
Prontoscript
This thread has 6 replies. Displaying all posts.
Post 1 made on Tuesday November 21, 2017 at 16:15
psathammer
Long Time Member
Joined:
Posts:
January 2011
12
Hi..
I'm starting to reconfigure my remote and i want it to "sense" if my equipment is on or off. So it can use less time turning stuff on and off when changing activity
So therefore i want to use script..
I added an extra page just to try, but when i press the button, nothing happens

This is what i made as an activity script..

CF.widget("PSW1","Activites","Please Wait..") .executeActions();
if (System.getGlobal ("Tv") == "Off")
{
System.setGlobal ("Tv",  "On");
CF.widget("TvOn","OnOff","Home") .executeActions();
}
delay(500);
CF.widget("PSW2","Activites","Please Wait..") .executeActions();
if (System.getGlobal ("Umc") == "Off")
{
System.setGlobal ("Umc",  "On");
CF.widget("UmcOn","OnOff","Home") .executeActions();
}
delay(500);
CF.widget("PSW3","Activites","Please Wait..") .executeActions();
if (System.getGlobal ("Android") == "Off")
{
System.setGlobal ("Android",  "On");
CF.widget("ShieldOn","OnOff","Home") .executeActions();
}
delay(500);
CF.widget("PSW4","Activites","Please Wait..") .executeActions();
CF.widget("UIn6","Inputs","UMC") .executeActions();
delay(500);
CF.widget("PSW5","Activites","Please Wait..") .executeActions();
delay(500);
CF.widget("PSW6","Activites","Please Wait..") .executeActions();
delay(500);
CF.widget("Hjem","OnOff","Home") .executeActions();

Anyone have an idea why it don't work
Post 2 made on Saturday November 25, 2017 at 14:03
DIYJeff
Junior Member
Joined:
Posts:
February 2015
10
Without see more of your setup, my first thought is what is the value "xx" from your getGlobals. Rather than testing for == "Off", test for != "On".
Post 3 made on Sunday November 26, 2017 at 08:37
buzz
Super Member
Joined:
Posts:
May 2003
2,713
psathammer,

I’m thinking along the same line that DIYJeff is hinting— how do you initialize your on/off variables? With your code, the variables must be initialized to “Off” at startup.

I realize that this is a test routine, but why do you include six “delay(500)” in series?

This is a programming style preference, but I hate “Please Wait...”
OP | Post 4 made on Monday November 27, 2017 at 17:31
psathammer
Long Time Member
Joined:
Posts:
January 2011
12
I have this in my home page

if (System.getGlobal ("Altibox") == null)
{
System.setGlobal ("Altibox", "Off");
}
if (System.getGlobal ("Popcorn") == null)
{
System.setGlobal ("Popcorn", "Off");
}
if (System.getGlobal ("Tv") == null)
{
System.setGlobal ("Tv", "Off");
}
if (System.getGlobal ("Umc") == null)
{
System.setGlobal ("Umc", "Off");
}

I tested it as getting please wait screen and therefore the wait.
I'm trying to set it up, so when i jump from activity to activity, it knows if my tv is on and do not have to send the command for it..
Like i have for my set top box, there I have to send another command 2 sec after power on..
Post 5 made on Tuesday November 28, 2017 at 04:52
buzz
Super Member
Joined:
Posts:
May 2003
2,713
I take a different approach to initialization. I make two, almost identical Home Activities. After a program reload or reboot, the first Home Activity initializes everything. No testing is required because you are guaranteed that this Activity has not been executed and will not be executed again. (Regular user pages, never reference this special Home Activity.) Page down on this initial Home Activity leads to a diagnostic Page where I have access to controlled device setup and any diagnostic buttons that I might want to provide for my use. Regular users will not notice anything different about this initial Home Activity, even if they reboot the Pronto.

Assume that, at some point, a user will manually turn something ON or OFF and your program will be out of sync with one or more devices. Since cable boxes are the largest pain in the neck in this respect, I don’t include any cable box power commands. The cable box stays ON and I instruct users to avoid the cable box power button. Mostly, I use devices that have discrete ON/OFF commands. A master “System Off” button will set all of the device flags to “Off”.
OP | Post 6 made on Tuesday November 28, 2017 at 06:59
psathammer
Long Time Member
Joined:
Posts:
January 2011
12
Most of my products have discrete On/Off commands.
I have used this setup for a long time with out any problem being out of sync.
But I want to stream line everything.
Post 7 made on Sunday December 3, 2017 at 18:23
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,217
I'd be willing to bet that these buttons have Page Jump actions in the ActionList...

CF.widget("PSW1","Activites","Please Wait..") .executeActions();

put a try/catch block around everything

Inside your catch(e) do a Diagnostics.log(e) or System.print(e) on the error being returned.

I think you will see that upon the Jump, the prontoScript is aborted with an error message (I forget what it is but is likely something like ActionList Error or something like that).

If you attempt to move to another activity while this one is executing, all javascript will be shutdown.

See Post #2 in this thread and try changing your calls to executeActions() to scheduleActions().

Note that if any widget that is executed causes a Jump to another activity, the actions scheduled after may be cancelled.


I personally would avoid putting the CF.widget().executeActions() into the Activity script and instead invoke them only after a page is loaded and ready to show (in a Page Script).

Alternatively, you might rearrange things and try it out.

function resetEverything()
{
// put in all the code you are doing in the activity script in the body of this function
}

and finally, invoke the function from your page script as follows:

resetEverything();
Lyndel McGee
Philips Pronto Addict/Beta Tester


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