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:
How do I execute actions via ProntoScript for a widget?
This thread has 5 replies. Displaying all posts.
Post 1 made on Friday July 10, 2020 at 10:45
mpg7321
Regular Member
Joined:
Posts:
June 2020
111
CF.widget("input3","amp1","amp");

I placed that in a button on a page. I have a button on the page "amp1" in the activity "amp". In the button properties, "input3" is inserted into the advanced tab "Pronto Script Name:" field. The button sends out an IR command.

I can not get this to work.

Last edited by mpg7321 on July 10, 2020 16:02.
Post 2 made on Friday July 10, 2020 at 13:53
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,994
Would you mind changing the topic of this thread to something more meaningful such as "How do I execute actions via ProntoScript for a widget?".

The activity containing the button must have ProntoScript Name of "amp". The page containing the activity must have prontoscript name of "amp1". And as you have done, the button must have a ProntoScript name of "input3".

You can do System.print(CF.widget("input3","amp1","amp"));

If something other than null is printed, then you have the above setup correct.


Please not that CF.widget() just retrieves a reference to a widget and does not set the label, change colors, or execute actions.

To be able to actually execute the actions in the widget, you must either use .executeActions() or .scheduleActions() methods as defined in the Dev Guide. Hoping you downloaded it and started reading. ;-)

If the Input3 button has a jump in the action list, you will want to do something like this as a jump will cause an exception as part of executeActions that needs to be safely caught and ignored. You can read more about this via a search on ExecuteActions try catch.


try {
CF.widget("input3","amp1","amp").executeActions();
}catch(e){
}

Or simply schedule the actions on the next available event loop.

CF.widget("input3","amp1","amp").scheduleActions();
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 3 made on Friday July 10, 2020 at 16:09
mpg7321
Regular Member
Joined:
Posts:
June 2020
111
Neither one of those works. when I navigate to that page, I can test the button and it does send out the IR command. I have all the labels set up as you described. You say to add "System.print(CF.widget("input3","amp1","amp"));" to a button, where does that display the returned data? Ye s I am new to this, I have been reading the developer guide but this is new to me. So I'm learning as I go.
Post 4 made on Saturday July 11, 2020 at 21:37
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,994
I did not say to setup labels, I suggested that you go to the Advanced tab of the buttons, pages, activities and specify these as the ProntoScript names.

I strongly suspect you are mixing label and ProntoScript Name.

Email me the config in question here along with specific instructions regarding what you want me to review and I will have a look.


In another of your threads, I mentioned using the _PS_DEBUG_ panel from Section 14.1 of the DEV guide.

I honestly think you are trying to do too much without learning what you are doing. May I recommend that you work through some of the examples in the Dev Guide? There are many, including those that tell you how to make a button repeat a command.

I am not trying to be rude, but rather attempting to help you "learn to fish" and become self sufficient. I understand you are very new to this and not a programmer. However, once you have solid foundation under you, it will allow you do things better, faster, and easier.

Lyndel
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 5 made on Saturday July 11, 2020 at 21:51
mpg7321
Regular Member
Joined:
Posts:
June 2020
111
No your not being rude. I have been reading through the guides and looking at samples. I kinda learn by going through samples. I always wanted one of these and finally picked one up. I have been trough many apps like iRule and DemoPad. I Taught my self how to code in python just for home automation. Now learning a new code.

I must not have been clear before, I am not using the label, I am using the ProntoScript names. I can get it to work if the command I am calling is IR, works like a champ. Can not get it to work if I am calling a script. The the _PS_DEBUG_ panel kinda worked some times when I had it running. More text I could fit on the screen usually came back. To be honest now that I figured out how to make mine own library files, I just call the script from the library and not from a button on a different page. Would still like to figure this out for never know if I will need it in the future.

Thanks for all your help.
Post 6 made on Sunday July 12, 2020 at 00:50
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,994
You cannot execute script in one button by calling executeActions() on that widget from elsewhere. The name execute/scheduleActions implies that only the actions and not the script is executed. You can put your script inside the label of a panel. Then use CF.widget to get the label contents and then eval(mylabeltext); please note that eval returns a single value. For some examples search for posts here containing the word eval. I’ve written about this quite a few times.
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