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:
Run actions and script from one button
This thread has 9 replies. Displaying all posts.
Post 1 made on Thursday February 11, 2021 at 17:12
mattmarsden
Junior Member
Joined:
Posts:
January 2021
27
So I want the power button on an activity to run some script (stop and clear a playlist) and execute some actions (turn of 3 devices by IR). I know this can't be done without creating a dummy button which I've done and I can call it with CF.widget("POWER","ACTION").executeActions(); and that works fine.If I put the script after it:

sendCommand("Stop()");
sendCommand("ClearPlayList(0)");
refreshPlaylist();

That script doesn't run. I've even tried putting that script in another button and doing

CF.widget("CLEAR","ACTION").executeActions();

CF.widget("POWER","ACTION").executeActions();

but whichever one is called last doesn't run. What am I doing wrong??
Post 2 made on Thursday February 11, 2021 at 18:30
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
Use scheduleActions() vs executeActions().

Search for try/catch executeActions.

execute/scheduleActions ONLY executes the actions in an ActionList. If you have script that you need to run as a result of pressing a button, you can use a panel label that contains the script (up to 32KB) and then eval() that script

var myScript = CF.widget("SCRIPT1","MYSCRIPTS","SCRIPTS").label;

eval(myScript);
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 3 made on Thursday February 11, 2021 at 22:46
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
If you are interested in a single button, put your IR actions into the ActionList, then put this into your script and then make sure that in PEP2, the ProntoScript and not the ActionList is showing.

sendCommand("Stop()");
sendCommand("ClearPlayList(0)");
refreshPlaylist();
try {
// within a button, 'this' refers to the button.
this.executeActions();
}catch(e) {
// ignore actionlist error
}
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 4 made on Friday February 12, 2021 at 03:10
mattmarsden
Junior Member
Joined:
Posts:
January 2021
27
Thanks Lyndel, I’ve tried all of those methods and the script for clearing the playlist runs but the actions don’t.
Post 5 made on Friday February 12, 2021 at 12:57
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
Send me a small config to my email address containing an example of what you are trying to do and I'll have a look. A small writeup of the buttons you are wanting to use, pages, etc will be much appreciated.

Note that if you are trying to execute the actions of 2 widgets and the first widget does a Jump then you will get an ActionListError.


You must then resort to 2 try catch blocks or use scheduleActions().

try {
CF.widget("WIDGET1").executeActions();
} catch(e) {}

try {
CF.widget("WIDGET2").executeActions();
} catch(e) {}

Send me a simple file and I'll have a look as it is likely something really simply you are missing.

Last edited by Lyndel McGee on February 12, 2021 13:30.
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 6 made on Friday February 12, 2021 at 17:51
mattmarsden
Junior Member
Joined:
Posts:
January 2021
27
Thanks very much Lyndel. I’ll get it over to you probably early next week.
Post 7 made on Sunday February 21, 2021 at 15:15
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
I did not see an email. Did you send one?
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 8 made on Friday February 26, 2021 at 02:51
mattmarsden
Junior Member
Joined:
Posts:
January 2021
27
Hi Lyndel, sorry for the delay in replying its been a bit hectic here - I didn't manage to get script and actions working from one button but I've got a work around where I don't actually need that to happen now.
Post 9 made on Friday February 26, 2021 at 17:40
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
If you want to send me an email, will be happy to have a look. :-)
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 10 made on Wednesday March 3, 2021 at 05:19
mattmarsden
Junior Member
Joined:
Posts:
January 2021
27
Thanks Lyndel I really appreciate it - I'll see how I get on with my workaround and let you know.


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