Assign multiple actions to a single button
Antoine Lampron 10
I've tried looking for similar posts but I haven't been successful.
I will control my HTPC/AV system/STB through unifiedremote. I would like to have a startup widget that will control the whole thing. I have a tablet with IR built in so I can control everything.
So for example, I would like to have a Netflix button. That would switch the AV input to the HTPC, launch the Netflix app and launch the Netflix remote.
The TV button would switch the input to the STB and launch the STB remote.
And on and on for the other things I want to do.
I haven't played around with the server but what I wanted to know is whether we can assign more than once action per button. If so, how would it look in the programming, just a line jump? I have little to no experience in coding but pretty tech savvy.
Thanks for the help everyone!
If you create a custom remote for this you could do anything you like with as many actions as you like on each button. You need to teach yourself a bit of coding but it should not be too much if you are using the actions that already exists in the built in remotes.
Look at the code for the different remotes that is installed on your computer or go to https://github.com/unifiedremote/Remotes/tree/master/Main. They are all open source.
If you need any help I am happy to help out but it helps if you take a look at the code and try to do something yourself first.
Antoine Lampron 10
Oh I know I need to learn some coding to get this going and I've been pouring over the example remotes on github but I don't think I've seen one with a plurifunctional button.
So just to make it sure, which of the following would be the good way for a button to launch spotify and mute at the same time (example)
actions.launchandmute = function() os.start("%appdata%\\Spotify\\spotify.exe"); actions.command(CMD_MUTE); end
actions.launchandmute = function() os.start("%appdata%\\Spotify\\spotify.exe"); end actions.launchandmute = function() actions.command(CMD_MUTE); end
Thank you for your help and if you have an example of a remote doing this kind of thing, I'd like to see it. Also, I'm not sure I'm grasping the whole "events" thing with the pre and post actions. Do you have an example remote using those?
Your first code snippet is correct. Note however for your example you may want to add some delay between the two actions (since it might take some time for Spotify to open before you can send the mute command).
actions.launchandmute = function() os.start("%appdata%\\Spotify\\spotify.exe"); os.sleep(3000); // wait 3 seconds actions.command(CMD_MUTE); end