|
|
|
Philips Pronto Professional Forum - View Post
|
|
|
|
|
|
|
The following page was printed from RemoteCentral.com:
Same button, different action for each...
| |
|
Topic: | Same button, different action for each press? This thread has 7 replies. Displaying all posts. |
|
Post 1 made on Tuesday January 6, 2009 at 22:25 |
thumper24 Lurking Member |
Joined: Posts: | January 2009 2 |
|
|
Hi all... new to the forum here, but looks like a lot of smart people out there that could help.
Okay, so I want to use a single button to do a different action on each press. Specifically, I'm talking about wanting to create a single power toggle button for a component that, on the remote, has one button for ON and one button for OFF. I'd like to have the single power button on the Pronto that will turn the component ON when I press it once, then OFF when I press it again, then start back over at ON for the third press. Would this require a script or can it be done without?
Thanks, B
TSU9400 PEP2
.
|
|
Post 2 made on Tuesday January 6, 2009 at 23:30 |
Daniel Tonks Wrangler of Remotes |
Joined: Posts: | October 1998 28,780 |
|
|
Are you 100% certain that your device doesn't have a normal power toggle code available?
|
|
Post 3 made on Tuesday January 6, 2009 at 23:37 |
Barry Gordon Founding Member |
Joined: Posts: | August 2001 2,157 |
|
|
Without Prontoscript, Two Identical pages that the same button on each page emits a different IR code and jumps to the other page.
Daniels solution is easier if such a code exists
|
|
Post 4 made on Wednesday January 7, 2009 at 00:58 |
Jasonvp Select Member |
Joined: Posts: | July 2008 2,404 |
|
|
What device brand & model?
|
|
OP | Post 5 made on Wednesday January 7, 2009 at 23:23 |
thumper24 Lurking Member |
Joined: Posts: | January 2009 2 |
|
|
This would be for an Epson Powerlite Pro Cinema 1080UB. PEP2 doesn't have it in the code database and I haven't been able to find any page that has the binaries listed out. If it has a power toggle code, I haven't seen it yet.
|
|
Post 6 made on Monday January 26, 2009 at 10:02 |
Spudnic Long Time Member |
Joined: Posts: | January 2009 10 |
|
|
I did something like this with my 9400. At first, coming from an old pronto b&w unit, I thought it was kind of stupid that the 9400 had a hard power button. But, after learning that it could support JavaScript ... oh sorry, ProntoScript ... I was thrilled. I'd always used a discret all on and all off button previously, but now I wanted the power button to toggle state, but still do an all on and all off. This would keep all the equipment from getting out of sync if toggle IR codes were used. Here is my setup.
Activity:Store PS Name: PSA_STORE
Page: Store PS Name: PSP_STORE
On that page are two buttons, all on (PS Name: PSB_ALLON) and all off (PS Name: PSB_ALLOFF). Attach all the codes you want to the actions on these buttons. And that's the main setup. The activity is never shown to the user, it's basically just a place to store code (hence my name). Then I attached the following code to the power button in the System activity ... but you could use the same code from any button anywhere.
// *** begin code *** var pwrOn = System.getGlobal("PSG_PWRON"); if ( pwrOn == null ) { pwrOn = "On"; } if ( pwrOn == "On" ) { // System.print("Powering Off: " + pwrOn); CF.widget("PSB_ALLOFF", "PSP_STORE", "PSA_STORE").executeActions(); pwrOn = "Off"; } else { // System.print("Powering On: " + pwrOn); CF.widget("PSB_ALLON", "PSP_STORE", "PSA_STORE").executeActions(); pwrOn = "On"; }; System.setGlobal("PSG_PWRON", pwrOn); // *** end code ***
Basically what's happening here is it pulls a global variable for the power state. This is done because as you switch activities and pages, your variables will disappear. We want it to maintain state across all of that. The next line is basically for setting the intial state on the first load where the global variable has not had a chance to set itself. After that, it's calling the actions on the correct button based on current state. Then finally setting the global variable again. Really all very simple. You can see where the PS Names come in on the script if you wanted to reuse this for something else ... or you have a problem with my naming conventions.
Best of luck.
|
|
Post 7 made on Monday January 26, 2009 at 12:12 |
djtaus Lurking Member |
Joined: Posts: | October 2008 4 |
|
|
Great description, Spudnic! Does it work in PEP2?
|
|
Post 8 made on Monday January 26, 2009 at 12:23 |
Lyndel McGee RC Moderator |
Joined: Posts: | August 2001 12,997 |
|
|
Yes, ProntoScript between PEPv1 and PEPv2 is identical.
Just beware of panel label optimization in PEPv2 (see my so you think you have a problem item #2, please).
|
Lyndel McGee Philips Pronto Addict/Beta Tester
|
|
|
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.
|
|
|
|