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:
script for page time out?
This thread has 11 replies. Displaying all posts.
Post 1 made on Monday July 19, 2010 at 06:51
Chris1986
Lurking Member
Joined:
Posts:
July 2010
6
Hi people

This is my 1st post on here, have used this site many times before to help me out but i can’t find anything on what I’m trying to do now.
I’ve used the rotary wheel scripts before just by altering a prewritten script, i was wondering if anyone would be kind enough to help me out?

I’m using PEP2 and need a simple time out script on a page load. E.g. A button is linked to a favourites page and after 30 seconds of inactivity on that page it then executes the command 'browse back' to return to the previous page

Any help would be great thanks

Regards Chris
Post 2 made on Monday July 19, 2010 at 07:10
BluPhenix
Long Time Member
Joined:
Posts:
December 2008
371
I'm not sure I understand you correctly, but.

Assign the browse backward to the back hardbutton.

then:
var inactivity = true;

page().onEntry = function () {
scheduleAfter(30 * 1000, checkInactivity);
}

function checkInactivity() {
if (inactivity) CF.widget(PS_BACK).scheduleActions();
}

This will start a wait of 30s after the page is loaded. If nothing happens during these 30 secs. the the remote will go to the previous page. I don't know what you do with that button, but if you add:

thebutton.onPress = function () {
whatever it has to do;
inactivity = false;
}

Then if you execute the keypress, the remote won't browse backward any more.
OP | Post 3 made on Monday July 19, 2010 at 07:23
Chris1986
Lurking Member
Joined:
Posts:
July 2010
6
That looks like what im after... only only problem is that the browse backward is a virtual button on a hidden page, how do i ammend the script to trigger a virtual button?
sorry for the noob questions but would like to get this done.
oh and thanks for your speedy reply
Post 4 made on Monday July 19, 2010 at 07:33
BluPhenix
Long Time Member
Joined:
Posts:
December 2008
371
Virtual you mean dynamic widget or just a on screen button?

If it's a classic button widget, select the button and for the action select Jump ... Browse backward. Give it a TAG (Name, not Label) and then

CF.widget("BACK_BUTTON_TAG",button page, button activity).scheduleActions().

Not noob questions, we all had to get to know this stuff somewhere in our past.
OP | Post 5 made on Monday July 19, 2010 at 07:51
Chris1986
Lurking Member
Joined:
Posts:
July 2010
6
Its a touch screen button, one you can press.
ive now got;


var inactivity = true;

page().onEntry = function () {
scheduleAfter(10 * 1000, checkInactivity);
}

function checkInactivity() {
if (inactivity) CF.widget(back, hidden, Sky Favourites).scheduleActions();
}


still no joy tho :(

I amended the 30 * 1000 in the script, i guessed by changing it to 10 it will give me 10 secs before it executes?

also I entered this in the activities script page, does it belong in here or on the page properties script?

many thanks
Post 6 made on Monday July 19, 2010 at 08:16
BluPhenix
Long Time Member
Joined:
Posts:
December 2008
371
you should put this, wait...

EDIT:

Here is a simple xcf with the stuff: -> [Link: dl.dropbox.com]


Just to let you know. You don't need to put the backward action on a button on the hidden page, you can pin it also to a macro (the category above the pages) and execute with:
CF.widget("MY_MACRO", "SOME_MACROS", "PS_MACROS").scheduleAfter();

Yes, the first number in the scheduleAfter is the amount of seconds it waits.

Last edited by BluPhenix on July 19, 2010 08:28.
OP | Post 7 made on Monday July 19, 2010 at 08:54
Chris1986
Lurking Member
Joined:
Posts:
July 2010
6
did you just knock that up for me!?

I can work out the rest from here, thank you very much for all your help you have been so helpful

All the best
Chris

Last edited by Chris1986 on July 19, 2010 09:09.
Post 8 made on Monday July 19, 2010 at 09:19
BluPhenix
Long Time Member
Joined:
Posts:
December 2008
371
No problem. Enjoy your pronto!
OP | Post 9 made on Monday July 19, 2010 at 10:04
Chris1986
Lurking Member
Joined:
Posts:
July 2010
6
I've put it on my project and its all working fine, BluPhenix you are the man!
but just a another question...
the page will work 100% but im thinking... is there a way where if you tap any key (make the control active) the ''timer'' will reset back to 10 seconds again because at the mo the page only stays on for 10 seconds then does the ''browse backward'' command, it does this even when your tapping the keys to keep it active, any idea why it does this???
Post 10 made on Monday July 19, 2010 at 11:41
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,994
Maybe he left that as an exercise for the user? Not sure.
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 11 made on Monday July 19, 2010 at 11:45
Chris1986
Lurking Member
Joined:
Posts:
July 2010
6
i get the hint :)
cheers guys
Post 12 made on Monday July 19, 2010 at 11:57
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,994
No idea if that is the case.

Several things that may help.

1. You cannot cancel a timer once started.
2. You can start subsequent timer.
3. You can use 'user data' such as sequence number to pass along with a timer. User data will be used as parameter to function when timer is called.
4. This user data can be a sequence number in stored in a variable for later reference.


// In activity script
var currSeqNum = 0;
function myTimerFunction(seqAtTimeOfTrigger)
{
if (currSeqNum === seqAtTimeOfTrigger)
{
// do something as user has not reset/restarted timer.
// jump back.
}
}

function setupOrRestartTimer()
{
currSeqNum = currSeqNum + 1;
CF.activity().scheduleAfter(10*1000, myTimerFunction, currSeqNum);
}


In each of your onscreen buttons that need to reset the timer, you will need to add prontoscript.


// Button Script
setupOrRestartTimer();
this.executeActions();


In the page script where you need to start the timer, you will need to add prontoscript.


// Page
setupOrRestartTimer();


Note that you can take this farther and use only a single active timer by keeping track of time remaining before JumpBack must occur. This is the more resource-friendly approach as there are only 64 allowed timers. That is, if you have a long timeout period and user presses 65 buttons, that 65th press will fail to start a timer and you will then lose JumpBack capability because timers 1 to 64 above will not act because sequence number does not match.

I leave this as an exercise for you to experiment with.

Philips did something like this in the RS232 scripts for Denon/Marantz receivers. Admittedly, their code is rather complicated and sometimes difficult to read but it does the job.
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