Create custom remote
Hi all, seems like a great app that I just purchased and need a little help.
I have the server running on the PC.
I want to create buttons/widgets/remote that send a command to the PC when pressed.
Once the PC receives the command, it knows what to do.
Could someone help get me started?
If you have some specific's you want to do then just ask
Yes, I do have a specific question but the problem is I'm not a coder.
I need the following script executed on the PC:
C:\Program Files (86)\girder32\event.exe -silent word
If I can get that script executed I'm all set.
I have successfully sent that command (command function) from the android to the PC and it executed successfully as a test.
My first thought was can I save that command and put it behind a widget?
After my researching though, it seems much more complicated than that.
I know I cannot send a command to the server and have the server execute a keypress. If I send a command to the server and the server executes the script, that would be fine.
So I don't even know whether I want the android to actually send the script or I want the android to send any old kind of command and have the server execute the script?
The server will execute the script. Think about the app as a web browser. It only displays a interface everything else is handled by the server.
See below. You can then add that remote action to a widget button.
actions.Launchevent = function () libs.script.shell("C:\Program Files (86)\girder32\event.exe -silent word"); end
<?xml version="1.0" encoding="utf-8"?> <layout> <row> <button text="Launch" ontap="Launchevent" /> </row> </layout>
as far as a Keypress that it is the simplest. The tutorial shows you how to make simple buttons sending key combinations. If you want just one key can use "keyboard.press" instead of "keyboard.stroke"
reconnnn seems to indicate the server would execute the script, but,
scuba75 seems to describe the scenario where the phone executes the script.
Is this a matter of different approaches or am I misunderstanding?
I think just a misunderstanding. The phone is just an input to the server. The server actually executes the script. Phone just tells the server which function to use. Just like remote and tv. Remote tells tv to change channel then the tv does it. But to work they both have to speak same language. The remote.lua file is the language so server understands requests from phone.
Thanks for the clarification scuba75.
Let's assume I copied and pasted the "Scripts" folder from C:\ProgramData\Unified Remote\Remotes\Bundled\Examples into the same location and changed its name from "Scripts" to "Girder".
Then lets say I go into layout.xml file, remove everything that's there and replace it with what you provided in the last pos, then saved it to the same location.
Then let's ssay I go into the remote.lua file, once again, remove everything andd replace it with what you provided in the last post and saved it in the same location.
Now let's say I go into the meta.prop file and make the changes including calling meta.name: Girder
Now let's say I go and restart the server as described in the help documents and view the log. I see no reference to girder in the log. When I go to the phone, I have no idea what to do and I see no reference to girder.
One more FYI.
In my example above - C:\Program Files (86)\girder32\event.exe -silent word
C:\Program Files (86)\girder32\event.exe is the path and,
-silent and word are arguments.
I'm not sure if your script is correct or not?
If not, I could use some help in the correct syntax.
You said you used the command remote and got the script to work. What I post was just simplifed. Instead of having to type command in the box this created a button to run this one and only command.
On a Windows server will be the same as opening a cmd prompt and typing in xxx
So if you want the button to execute
C:\Program Files (86)\girder32\event.exe -silent word
Then the script is right.
I have not looked at the "scripts" meta.prop so I can't say that just changing "meta.name" is all you need to do.
I would go to
And copy the keys folder then rename to Girder.
Change meta.name to Girder
then replace the layout.xml and remote.lua code with what I provided.
Then on phone from remotes click green + sign on bottom right corner and scroll down till you find Girder. Select it. Click on the back arrow at top left.
this will add the remote with the one button.
Now click on it and it will execute the script.
Hope this makes sense.
Thanks very much shark for helping me out.
Since my last post and this one, I've been googling, reading, learning and testing all about lua.
Somehow, someway, I stumbled across my solution. Here's where I ended up. It may not be right, but it works.
My answer was to create a "Girder" folder and place that folder in the "Custom" folder.
Here is my meta.prop file:
meta.description: Control Girder from Android
Here is my layout.xml file:
<?xml version="1.0" encoding="utf-8"?>
<button text="All ON" ontap="ON" />
<button text="All OFF" ontap="OFF" />
<row> <button text="Vol +" ontap="VOLUP" /> <button text="Vol -" ontap="VOLDOWN" /> <button text="Mute" ontap="MUTE" /> </row> <row> <button text="HTPC" ontap="HTPC" /> <button text="TV" ontap="TV" /> </row> <row> <button text="Skip +" ontap="SKIPAHEAD" /> <button text="Skip -" ontap="SKIPBACK" /> </row> <row> <button text="Reboot HTPC" ontap="REBOOTHTPC" /> </row> </tab> <tab text="Kenwood"> <row> <button text="Vol +" ontap="VOLUPKEN" /> <button text="Vol -" ontap="VOLDOWNKEN" /> <button text="Mute" ontap="MUTEKEN" /> </row> <row> <button text="Computer" ontap="KENCOMPUTER" /> <button text="Radio" ontap="KENRADIO" /> <button text="TV" ontap="KENTV" /> </row> </tab> </tabs>
Here is my remote.lua file:
local script = libs.script;
-- Script Library
--@help Command 1
actions.ON = function ()
os.execute('"C:/Program Files (x86)/girder32/event.exe" -silent allon');
--@help Command 2
actions.OFF = function ()
os.execute('"C:/Program Files (x86)/girder32/event.exe" -silent alloff');
--@help Command 3
actions.VOLUP = function ()
os.execute('"C:/Program Files (x86)/girder32/event.exe" -silent vol+');
--@help Command 4
actions.VOLDOWN = function ()
os.execute('"C:/Program Files (x86)/girder32/event.exe" -silent vol-');
--@help Command 5
actions.MUTE = function ()
os.execute('"C:/Program Files (x86)/girder32/event.exe" -silent mute');
--@help Command 6
actions.HTPC = function ()
os.execute('"C:/Program Files (x86)/girder32/event.exe" -silent watchhtpc');
--@help Command 7
actions.TV = function ()
os.execute('"C:/Program Files (x86)/girder32/event.exe" -silent watchtv');
--@help Command 8
actions.SKIPAHEAD = function ()
os.execute('"C:/Program Files (x86)/girder32/event.exe" -silent skip+');
--@help Command 9
actions.SKIPBACK = function ()
os.execute('"C:/Program Files (x86)/girder32/event.exe" -silent skip-');
--@help Command 10
actions.REBOOTHTPC = function ()
os.execute('"C:/Program Files (x86)/girder32/event.exe" -silent reboothtpc');
--@help Command 11
actions.VOLUPKEN = function ()
os.execute('"C:/Program Files (x86)/girder32/event.exe" -silent volupken');
--@help Command 12
actions.VOLDOWNKEN = function ()
os.execute('"C:/Program Files (x86)/girder32/event.exe" -silent voldownken');
--@help Command 13
actions.MUTEKEN = function ()
os.execute('"C:/Program Files (x86)/girder32/event.exe" -silent muteken');
--@help Command 14
actions.KENCOMPUTER = function ()
os.execute('"C:/Program Files (x86)/girder32/event.exe" -silent kencomputer');
--@help Command 15
actions.KENRADIO = function ()
os.execute('"C:/Program Files (x86)/girder32/event.exe" -silent kenradio');
--@help Command 16
actions.KENTV = function ()
os.execute('"C:/Program Files (x86)/girder32/event.exe" -silent kentv');
On the app, I open UR and choose the Girder remote, it loads, and the buttons do what they're supposed to do. Just an FYI, attached to the PC is a USB-UIRT and most of these UR commands execute a girder command, that, in turn, executes a blast of an IR code out of the USB-UIRT. My phone doesn't have IR capability, but the PC does. Now my phone has a remote that can control IR devices.
Thanks for your help and I'm all set. Perhaps my effort and documentation can help someone else who is in a similar situation.
Very good. I didn't realize you were trying to make a multiple button remote, I have never seen or used girder. But I am glad you found a solution. It is similar to what I posted but yours is using native lua code instead of libs. I suggest to repost in projects following the template with your completed remote.
Well, when I started this thread I just wanted to get 1 activity set up. Once I got that one activity I was confident I could add the additional activities without problem. That is indeed how it worked out. Once I got a command, sent from the phone, to activate a girder command I was all set. The rest was just copying/pasting/adjusting.
Once I got girder to open "Word", I knew I could get girder to do anything.
I now can get UR to turn lights on/off, wake/sleep any computer, change channels on the TV ... anything. Since girder can basically do anything and now UR can control girder, UR can do anything.
FYI, girder is basically to a PC what tasker is to an android. The difference is that a PC is faaaaaaaar more capable than a portable touch device. For the PC world, eventghost is similar, but I use girder.
When I get a chance, I will place my files into the project template.
Sorry from above. I called you sharrk when I should have called you scuba. It is shark week though. Don't know when scuba week is.
Please post your remote as a project as well so other can find and learn from it.
My remote send a commandline argument to a program on the PC (Win7)
In my case, the program I am targeteing is Girder. Girder is automation software much like Tasker (Android) or Eventghost (PC).
The way it works are commands are created in girder. Since girder is so powerful and flexible and has so many plugins, girder can do almost anything (USB-UIRT, x10, programs, mouse and keyboard manipulation. Single commands and macros - a series of commands.
"Eventstrings" are then attached to these commands. evenstrings (ie, triggers) can be anything, but one of the things an eventstring can be is a plain text word, such as "Word"..
Girder installs an application named "event.exe". It is this app that listens for the word to arrive.
I use girder to do many, many things.
Last week I was lead to believe that Unified Remote was capable of sending the word, for example "Word" to girder from my phone.
I use batch files all the time and the syntax is:
C:\Programs Files (x86\girder32\event.exe -silent word
(note: the argument "-silent" simply tells girder, or more specifically event-exe, not to show any emotion or flash any boxes. Unless you want to see event'exe doing its job, I place "-silent" or all eventstrings)
When I click the batch file, it sends the word "Word" to event.exe and girder executes the associated program.
This thread started as my request to understand how to get UR to execute the above command from my phone
I have accomplished my goal. The problem is I'm not a software person. I don't understand these files or commands or any of the syntax. I'm not even sure if these files are technically correct. All I know it that they work.
The great thing about this is that I've been using girder for 15 yrs +. My gml file (the file I created that contains all the commands and eventstrings) is very long and involved. My PC, running girder, is an automation extravaganza. It contains dozens and dozens of commands.
Because UR can trigger girder commands on the PC, in effect, UR can execute almost any action. It's great.
2 thoughts for this project:
- Seems my remote syntax is capable of sending a commandline argument to any program. I use it for girder but if I ever had the need to send an argument to any file, this syntax could be adjusted to work.
- If UR could spend extra effort of creating and documenting remotes attached to automation software on the PC (Eventghost, girder, there are others) then UR becomes an incredibly powerful tool that is capable or triggering any command that the automation software can create. Since automation software, running on a PC is inherently so powerful and flexible, it gives UR almost unlimited capabilities.
NOTE: I'm not a developer, I don't have a website and there is nowhere for to host any of these files. If UR wants to grab these files, adjust them, document them, host them, please do.
The code you used is correct and it is documented. You used straight lua code but instead of os.execute you could have used libs.script.shell and it would work exactly the same. This command is documented in https://github.com/unifiedremote/Docs/blob/master/libs/script.md
I am not a coder either but have made my remotes work by checking the docs, looking at other remotes and the world of Google. Good luck on next project!
I did some testing myself, since I'm planning to use unified remote with eventghost.
os.execute creates a cmd window, which is probably not the best use.
libs.script.batch I think is the best option for Win. I don't know if it's true, but to me it seems like it runs just a tad faster than libs.script.shell, or am I wrong?