10/10/25 - It’s been so long since we’ve last seen you!
10/24/22 - In searching for the perfect day, Timmy discovers something unexpected!
9/04/22 - That childhood favorite is back in a new Timmy video.
7/31/22 - It’s time for my second new Just Like Timmy video!
7/12/22 - Why not check out my new YouTube animation channel, Just Like Timmy!
|
|
 |
|
The following page was printed from RemoteCentral.com:
|
ProntoScript Device Status Tracking For...
| |
|
| Topic: | ProntoScript Device Status Tracking For Beginners This thread has 21 replies. Displaying posts 1 through 15. |
|
| Post 1 made on July 14, 2008 at 10:38 |
Herb Crane Long Time Member |
|
|
I am a self professed amateur ProntoScript user. Other than using the rotary wheel the lure of ProntoScript to me was its ability to track a devices state and then take conditional action based upon the current state. The scripting necessary to do this now seems simple but posed a challenge at first. Following are details about how I managed and some pointers to other amateurs out there seeking to do the same. ProntoScript is not as daunting as it seems initially and anybody reasonably familiar with the remote can do it. As always read the Developers Guide. Try the examples in the guide and start small as it will be a lot easier to track down your errors. My solution works for me and is relatively simple. There are many ways to do the same thing with ProntoScript so don’t feel confined to what I have done. Deviate as necessary and keep smiling. Anybody that wants to give it a try continue reading, bust out your editor, and play along. First of all, whenever possible buy devices with discrete commands and avoid the headache. If you find yourself in a similar situation as I was and have some spare time to kill give it a try. I am using ProntoScript to track two devices. These are a screen and an old amp from before the days of discrete IR that has been relegated to the bedroom. While the screen has discretes, the motor does not seem to like cycling when not needed. My examples are for the amp only. Also, for this to work more than be a pain your control of the devices needs to be very stable. Later I describe a synchronization page I developed that displays the global variables and allows the user to synchronize the device. But this should be avoided through positive device control. I am using the RFX9400 and IR emitters. This would not have been possible with my old 3000 and direct IR. For the screen the global variable is Screen and for the amp it is BRAmp (For those of you with dirty minds this short for BedRoomAmp). Below is the script initializing the amp variable to the Off state. This is on the Home page Advanced tab in the Module Script field. Since the Home page loads first after a reset or download this is the first thing to be done. if (System.getGlobal ("BRAmp") == null) { System.setGlobal ("BRAmp", "Off"); } For my solution to work, any activity that uses the amp or screen needs to have two widgets. One to do the activity if the amp is on and the other to do the activity if the amp is off. The button pushed to initiate the activity needs to have ProntoScript to test the global variable for the status of the device and use the correct widget. For instance, when wanting to listen to a CD, I push the button on the macros page that tests the variable state and then selects the correct widget. Below is the script from my macros button for listening to the CD. if (System.getGlobal ("BRAmp") == "Off") { System.setGlobal ("BRAmp", "On"); CF.widget("CD_AMP_OFF","codePage").executeActions(); } else { CF.widget("CD_AMP_ON","codePage").executeActions(); } This script goes in the field ProntoScript that is visible when the PS button is pressed under the Actions Tab of the Button Properties. CAUTION: Make sure the PS button stays in the pressed state so the script is visible. I wasted a good deal of time until I figured that one out. The two widgets referenced are CD_AMP_OFF and CD_AMP_ON. These are on the page with the ProntoScript name codePage. My widgets page is under the same Activity/Device so do not need the Activity identifier in the CF command. Also important is to set the global variable prior to the CF.widget execution. If you do the widget first the script is aborted and you will not get to the line changing the global variable state. My widget actions have page jumps to a “please wait” screen which probably causes this. Set the page ProntoScript name in the ProntoScript Name field located in the Page Properties Advanced tab. The widgets have all the actions necessary for the macro like normal in the Button Properties Actions tab. In the Actions tab select the PS button and put the widget reference name in the ProntoScript Name field. In my example CD_AMP_OFF. It doesn’t seem to matter if the PS button stays pressed here and I have no idea why it would on the button with the script above. I use similar script and widgets for a macro that turns everything off. In addition to the macros page I have to initiate the activities and shut down, I have maintained the individual power toggle on the device page by doing the following: if (System.getGlobal ("BRAmp") == "Off") { System.setGlobal ("BRAmp", "On"); CF.widget("AMP_POWER","codePage","BedRoom").executeActions(); } else { System.setGlobal ("BRAmp", "Off"); CF.widget("AMP_POWER","codePage","BedRoom").executeActions(); } The power toggle hard button has this script in the ProntoScript field as described above. In this example a single widget is used. This widget is AMP_POWER on the page codePage in the Device/Activity BedRoom. Since the page containing the power toggle widget is under a different device, it is necessary to reference the Activity identifier where the page containing the widget is located. In this case the Activity name is BedRoom. This is entered in the ProntoScript Name field in the Advanced Tab of the Device Properties. In order to correct any discrepancy between actual device state and global variable, I made a page to help synchronize. This page displays the global variables and has buttons to change the device status that do not have script to change the global variables. This page has the following script in the ProntoScript field of the Advanced Tab of the Page Properties. var w = widget("SCREEN_STATUS"); var w1 = widget("BRAMP_STATUS"); var sstatus = System.getGlobal ("Screen"); var brastatus = System.getGlobal ("BRAmp"); w.label = sstatus; w1.label = brastatus; When this page is loaded the status of the two variables is queried using the getGlobal and displayed next to buttons linked to the device commands. In my situation these are the screen up/down and the amp power toggle. I have found this useful when starting to use the remote freshly after a download. It seems that the remote takes a few button pushes before working correctly. I have no idea why and may be unique to me. If you have put up with my rambling up to this point I hope it was helpful. Herb
|
|
| Post 2 made on July 14, 2008 at 23:26 |
|
Joined: Posts: RC XP: | August 2001 13,168 552⭐︎ |
|
|
Herb, I've very much enjoyed reading the topics you've posted. You might want to consider uploading files and then post links to the uploaded file. You can include a writeup in an MS Word document along with an example XCF. This could then be uploaded to the files section under "ProntoScript". A picture is worth 1000 words. Also, as so many folks have problems missing a 'tag', having a working example is priceless. Lyndel
|
Lyndel McGee Philips Pronto Addict/Beta Tester
|
|
| OP | Post 3 made on July 15, 2008 at 10:04 |
Herb Crane Long Time Member |
|
|
Lyndel, Thanks for the kind words. I considered uploading my file. This seemed natural to me coming from the Pronto NG side with my 3000. The people on that board are very open to file sharing. However, people on this board seem very concerned about their config file art being copied. I have indeed copied art from the few uploaded XCF files uploaded as part of the contest and did not want to post these for sharing since the artwork is not mine. The files I used were as follows: Noel Blackman - Aura & Simplify for background and buttons Carlton Bale - Alpha King Brew for wait screens. Noel, Carlton, If you are on the board and don't mind me posting my XCF that used some of your art, please say so. Herb
|
|
| Post 4 made on July 15, 2008 at 19:24 |
|
Joined: Posts: RC XP: | August 2001 13,168 552⭐︎ |
|
|
Would not suggest uploading your entire config, but a smaller example config outlining the topics/concepts you cover in your post above. For example, if you look @ ProntoPong or Galaxy 9600 PS, these configs have minimal ProntoScript and the download description outlines some key concepts available in each file. There's also a Scrolling Window example file posted as well that is nothing more than just an example of how to do something. Barry Gordon, on his site also has a Slider example to which I added an Object-Oriented version. AFAIK, The contest entries become property of Philips upon submission so, in theory they are public domain. However, if they do have license agreements inside the zip packaging, you could include those agreements with your upload.
Last edited by Lyndel McGee
on July 15, 2008 19:31.
|
Lyndel McGee Philips Pronto Addict/Beta Tester
|
|
| Post 5 made on July 15, 2008 at 23:07 |
cosmicvoid Long Time Member |
Joined: Posts: RC XP: | November 2007 104 1⭐︎ |
|
|
On July 15, 2008 at 00:26, Lyndel McGee said...
You can include a writeup in an MS Word document along with an example XCF. This could then be uploaded to the ... I'd like to mention that some people do not use MS Word, and have no desire to use it. Uploading files in a non-proprietary document format would make it easier on those folks.
|
|
| Post 6 made on July 15, 2008 at 23:42 |
Barry Gordon Founding Member |
Joined: Posts: RC XP: | August 2001 2,160 128⭐︎ |
|
|
And what would you consider a non proprietary document format? DOS text? There is a free word viewer from MS that can be downlaoded
|
|
| OP | Post 7 made on July 16, 2008 at 10:08 |
Herb Crane Long Time Member |
|
|
Lyndel, After posting yesterday I realized you were not talking about the system set up files but rather the files in the ProntoScripts section. Although my ProntoScript examples will pale in comparison to those already posted, I believe they will be useful to other novice personnal users like myself and will do this. Herb
|
|
| Post 8 made on July 16, 2008 at 12:26 |
|
Joined: Posts: RC XP: | August 2001 13,168 552⭐︎ |
|
|
The files in that section are pieces and parts that illustrate examples. Yours will not "pale" but rather serve as guidance for others. Lyndel
|
Lyndel McGee Philips Pronto Addict/Beta Tester
|
|
| Post 9 made on July 16, 2008 at 14:21 |
|
Joined: Posts: | November 2004 43 |
|
|
Herb, I too, wish to chime in here and give a vote of thanks for your postings. They are never ramblings. I am trying to learn more about PS and I have been reading your postings with great interest. They are small, easy to use ideas and you have provided the requisite explanations of the hows and why one needs to understand to make the device work. It has helped me with getting out the door and make something work that I can tinker with and experiment with after it is functioning. Although the developers guide gives some very simple examples, yours takes it further by expanding on a real, functioning idea and then it is left to the user to tinker with it, play with it and expand on the concept. What I was not understanding in the guide, you've helped me make something really work now. Please continue with these little snippets of real, working ideas that is what, I believe, many of us less experienced and informed can make work in our own homes.
Last edited by pclark
on July 16, 2008 19:18.
|
|
| Post 10 made on September 2, 2008 at 05:55 |
For my solution to work, any activity that uses the amp or screen needs to have two widgets. What about activities that use the amp AND screen?
|
|
| Post 11 made on September 2, 2008 at 10:52 |
|
Joined: Posts: RC XP: | August 2001 13,168 552⭐︎ |
|
|
VeryPSB, Herb's statement and the use of work "or" should not be taken literally. If you need to track status of 2 devices, you need 2 widgets and 2 global strings. If you need to track status of 3 items, you will need 3 widgets and 3 system global strings. Once you test this out, it should start to make more sense.
|
Lyndel McGee Philips Pronto Addict/Beta Tester
|
|
| OP | Post 12 made on September 2, 2008 at 16:24 |
Herb Crane Long Time Member |
|
|
VeryPSB, In my example the screen and amp are in different rooms so are controlled separately. If in the same room and always on or off simultaniously, it is also not complicated. When controlling them separately so as to have amp on/screen up, amp on/screen down, amp off/screen up, and amp off/screen off, you could follow the model with a widget covering each contingency. So for the two components that need independent but related control you would end up with 4 widgets. For an activity macro the script could test the global variables and select the proper widget to put the components in the desired state. For three independent but related components there would be 8 widgets. Herb
|
|
| Post 13 made on September 3, 2008 at 01:25 |
Herb, Thanks for your reply. Where I'm lost is the if-then-else structure. This gives you 2 options, not eight. I need to control my STB, Projector and Popcorn Hour. All these devices have only toggle codes. These devices can be used with my TV or Projector. On my home page I have seperate activities for each of the devices and display. (STB/TV, STB/Projector, Popcorn Hour/TV, Popcorn Hour/Projector). However activities which don't use any of these devices should be able to shut down these devices when not needed, i.e. Listen to CD. (Switching between activities). I hope you can help me setting up a working 'device status tracking' in this setup. Best regards, Dennis.
|
|
| Post 14 made on September 3, 2008 at 02:12 |
|
Joined: Posts: | December 2007 59 |
|
|
The way I do it with my Russound CAM is using arrays. The objective is a little bit different from yours, but at the end, this is all about checking status of different elements (in your case, STB/Projector,..., in my case zone onoff status)/ Russound CAM is a 6 zones / 6 sources amp. Each zones has own parameters (on/off status, volume, source, bass, treble, loudness,....). In my script, I use an onoff array made off 6 elements, one for each zone. onoff () = [0,0,0,0,0,0] When zone 1 is on, I just set element 1 of the array to 1. I then have onoff () = [1,0,0,0,0,0] It is then easier for me to scroll through onoff array elements using "loops": I have a function that checks any single elements in order to set the correct image to onoff buttons for each zone (red if zone off, green if zone on) I have a function that adds all elements and if the sum is 0, it means that all zones are off, I can then set the correct image to an global onoff button. If sum is different from 0, it means that 1 zone is on and then the image of the global onoff button is change accordingly,... I use the same approach for volume, status,... and it works fine. Next step for me will be to transform array into global variable (following Lyndel's advice) in order to recover volume status in other activites and to be able to change Russound volume from there. Hope it helps. If you need script examples, just ask. I will post. Eric.
|
|
| Post 15 made on September 3, 2008 at 02:25 |
Hi Eric, I'm interested in your approach and would very much like to see your script examples. Dennis.
|
|
 |
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.
|
|