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:
Calling button outside the current activity with PS
This thread has 4 replies. Displaying all posts.
Post 1 made on Saturday January 5, 2008 at 09:09
BigBen11
Long Time Member
Joined:
Posts:
August 2007
24
Hi all,

My TV has a power toggle button only and I can't find any discrete codes. If I switch Activities the TV is power toggled and of course I don't want that. I am trying to write a script by using a global variable which keeps the state of my TV.

The script below is working fine when the ACTIVITY_MACROS page is within the current activity but I don't want that. I have a "activity" called Macros where I keep all my macros but I can't find a way to execute buttons on pages outside the current activity.

I am also looking for a way to jump to pages outside the current activity to provide feedback to the user (eg. Please wait, system is being setuped).

Any help will be appreciated

if (System.getGlobal("power_toggle") == "off")
{
System.setGlobal("power_toggle", "on");
page("ACTIVITY_MACROS").widget("TV_POWER").executeActions();

page("ACTIVITY_MACROS").widget("WATCH_TV").executeActions();
}
else
{
page("ACTIVITY_MACROS").widget("WATCH_TV").executeActions();

}
Post 2 made on Saturday January 5, 2008 at 11:14
Barry Gordon
Founding Member
Joined:
Posts:
August 2001
2,157
I generally write the reference to the button as
CF.widget("WATCH_TV","ACTIVITY_MACROS").executeActions();

Sometimes I need the "CF" or sometimes "GUI", easy to try.

In general the reference is widget("ButtonTag","PageTag","ActivityTag"). ....
Leaving arguments out (starting from the right) defaults to current activity, current page. If Outside the Activity you might need the CF prefix as in CF.widget

Last edited by Barry Gordon on January 6, 2008 14:19.
OP | Post 3 made on Saturday January 5, 2008 at 12:11
BigBen11
Long Time Member
Joined:
Posts:
August 2007
24
Barry,

Thanks, You helped me on my way.
Do you also know how to program a jump ? (eg after power off I want to jump to the Home screen)


Thanks in advance
Post 4 made on Saturday January 5, 2008 at 12:54
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,999
The way you do this is to code a 'Jump' in the ActionList of a widget and then issue 'executeActions' against the widget containing the jump. Be sure that you do this using ScheduleAfter as all scripts will end as soon as the Jump out of the activity is processed.

Here's an example to play with.

var w = CF.widget('GoHome','MyPage','MyActivity);
if (w)
CF.activity().scheduleAfter(10,function(x){try{x.executeActions();}catch(e){Diagnostics.log(e);}},w);

It is important to use try/catch here as you don't want to let any errors propagate out of your function as this could, in some cases, cause instability in the Pronto. It's not so much of a problem now as it was in earlier ProntoScript releases but it is always good practice to prevent errors from propagating out into the system from your own code.
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 5 made on Sunday January 6, 2008 at 04:10
BigBen11
Long Time Member
Joined:
Posts:
August 2007
24
thanks a lot !

You both are a great help


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