Convert Widget to Remote
Hi, just yesterday discovered UR and liking what I am seeing, so far.
To begin with, I have created (two) home-screen widgets that I have configured to control a program on my HTPC: There is no pre-existing remote control for that program and hence I wish to create one of my own.
Now, for the most part, I just want to send keyboard strokes to that program so that is what the buttons of my widget are set up to do. Anyway, having accomplished that, I am now wondering if there is a way of converting those widgets into actual remote controls. It seems that it would not be difficult for the UR app on the client-side (i.e. phone) to generate the XML, PROP and LUA files. I could then take those and customise the remote (different icons, etc).
My question is: Is this already do-able? If so, how?
I'm not sure if this is possible, but someone else might know otherwise.
Though it seems like you've done the hard work already, just need to write those files yourself? There's tutorials here.
It would be basically:
meta.name: HTPC Remote meta.author: ColinE66 meta.description: Remote for HTPC meta.tags: HTPC
<?xml version="1.0" encoding="utf-8"?> <layout> <row> <button icon="playpause" ontap="HTPC_Command_1" /> <button text="HTPC Command 2" ontap="HTPC_Command_2" /> </row> </layout>
local kb = libs.keyboard; [email protected] HTPC Command 1 actions.HTPC_Command_1 = function () kb.stroke("space"); end [email protected] HTPC Command 2 actions.HTPC_Command_2= function () kb.stroke("ctrl", "s"); end
Then you put all that in a folder in C:\ProgramData\Unified Remote\Remotes\Bundled\Unified\Examples.
https://github.com/unifiedremote/Docs is a great help for syntax.
Thanks Nathan, I'd picked up on those tutorials already and I can see that (for my simplistic use-case) it wouldn't be difficult to do from scratch. But, it occurred to me that such code was probably being generated (under the cover) and that it wouldn't be a huge leap to provide the functionality to export the three 'internal' files, rather than the text string that is generated via the widget Export function.
Anybody else? Devs?