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 variable
This thread has 5 replies. Displaying all posts.
Post 1 made on Saturday December 13, 2008 at 05:37
aag
Long Time Member
Joined:
Posts:
September 2006
57
might you be willing to explain to me how, in ProntoScript, to declare a variable whose scope shall survive the end of the subroutine? The purpose would be to use it as a counter of how often the subroutine was invoked...

many thanks in advance for all help!
Post 2 made on Saturday December 13, 2008 at 07:37
tenchi
Long Time Member
Joined:
Posts:
January 2006
156
If you declare it outside the function on the page it should be fine, or define the variable in the device prontoscript..

iLoop = 0

function myLoop(){
iLoop = iLoop + 1
// you could use iLoop += iLoop (could be =+ I always get it wrong)
}
Post 3 made on Saturday December 13, 2008 at 08:14
Barry Gordon
Founding Member
Joined:
Posts:
August 2001
2,157
Just define it at the activity level. It will then be global to all scripts at the activity level and all scripts running on pages of that activity
OP | Post 4 made on Saturday December 13, 2008 at 15:38
aag
Long Time Member
Joined:
Posts:
September 2006
57
a million thanks - it works nicely! Now, is there a way to make its scope truly global? Right now, the variable reinitializes every time I navigate away from that activity. I tried placing it onto the activity property of the home page, but that doesn't appear to cut it...

Last edited by aag on December 13, 2008 16:02.
Post 5 made on Saturday December 13, 2008 at 16:00
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
13,006
Have a look at System.setGlobal() and System.getGlobal() which stores/retrieves string values based on a user-defined key.
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 6 made on Saturday December 13, 2008 at 18:51
Barry Gordon
Founding Member
Joined:
Posts:
August 2001
2,157
To be precise, when you leave the activity you may consider the variable destroyed as it will be when the garbage is collected. When you re-enter the activity it is re instantiated and given the initial value you provided in the code.

Lyndel's comment gives you the only other solution.


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