How do I run a python script that's on my computer with command prompt from my phone?
I would like to create a custom remote that will use the computer's command prompt (with administrator privileges) to execute a python script. I'm fairly experienced with custom remotes, but I don't understand the example of command line code.
Python Script: C:\Computer-Lights.py
What's the code that I place in the remote.lua file?
Okay, I have it working. Here's my solution for anyone that comes across this post. Of course, you'll have to change the path_to_file, file.py and file.bat to work with your own code, but I wanted to stay consistent with my original question.
Create a batch file by opening notepad and add (then save as "Computer-Lights.bat":
Right-click your newly created "Computer-Lights.bat" file and "Create a Shortcut"
Delete any spaces from your new shortcut (e.g. "Computer-Lights.bat-Admin"
Right-click "Computer-Lights.bat-Admin" and select Properties > Shortcut > Advanced... > Make sure 'Run as administrator' is checked
Hold shift and right-click "Computer-Lights.bat-Admin" and click "Copy as path"
Open remote.lua for whichever Unified Remote you would like to create a button for
Add the following code (you can paste the "Copy as path" content into the brackets for os.open("COPY_AS_PATH_CONTENT"):
[email protected] ComputerLightsToggle
actions.ComputerLightsToggle = function ()
- Open the layout.xml for the corresponding Unified Remote and add:
<?xml version="1.0" encoding="utf-8"?>
<button text="Computer Lights Toggle" ontap="ComputerLightsToggle" />
- Reload your remotes using the Unified Remote server.