Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
how can I run a command line via a button?
#1
I have 2 command lines that I use to start a vpn.
In the terminal these are:
sudo openvpn --config /etc/openvpn/filename.ovpn
sudo openvpn stop

How can I add these as a shortcut so that I can just click on them within xbmc?
Reply
#2
Question 
1. Create one shell script which is Linux executable script.
2. Put bot the command inside that script.
3. Use RunScript(<script name>).
4. Put RunScript code in button onclick event.

Thanks
Prashant
Reply
#3
(2015-04-13, 12:26)pjmavadiya Wrote: 1. Create one shell script which is Linux executable script.
2. Put bot the command inside that script.
3. Use RunScript(<script name>).
4. Put RunScript code in button onclick event.

Thanks
Prashant

How do I get the button on screen within xbmc?
ie so I can move into say Programs-->Add ons and just click to start to script?
Reply
#4
Download this zip file:
Open default.py and write commands to execute when you click on program addon.
(this addon will be listed under program addon section)

<< https://www.dropbox.com/s/oe5f8f8fkbljy1...d.zip?dl=0 >>
Reply
#5
I know this is an old thread but the solution is exactly what I was looking for.
Unfortunately I can't get get it to work in Kodi 18.5 on Raspbian Buster, using your addon and modifying it with your instructions
Anything I can change to get it to work?

Thanks
Reply
#6
(2020-02-25, 06:56)deepeeme Wrote: I know this is an old thread but the solution is exactly what I was looking for.
Unfortunately I can't get get it to work in Kodi 18.5 on Raspbian Buster, using your addon and modifying it with your instructions
Anything I can change to get it to work?

Thanks

Hi,

last time i tried to use it RunScript didn't work for me (given that's like a year ago). I ended up using subprocess.popen
Feel free to copy paste what you need from here 
https://github.com/Takezo36/applauncherk...pRunner.py

If you just want to have a link to some program in kodi you can checkout my applauncher plugin
https://github.com/Takezo36/repo/blob/ma...p?raw=true
just deactivate the os listing and add a new custom entry.

Edit:
Wooops small correction i didn't have a problem with runscript but with system.exec. any ways runscript is the wrong thing in the first place. AFAIK it's meant for running python scripts not shell scripts. For shell scripts go for subprocess.popen
Reply
#7
(2020-04-03, 17:24)Takezo36 Wrote:
(2020-02-25, 06:56)deepeeme Wrote: I know this is an old thread but the solution is exactly what I was looking for.
Unfortunately I can't get get it to work in Kodi 18.5 on Raspbian Buster, using your addon and modifying it with your instructions
Anything I can change to get it to work?

Thanks

Hi,

last time i tried to use it RunScript didn't work for me (given that's like a year ago). I ended up using subprocess.popen
Feel free to copy paste what you need from here 
https://github.com/Takezo36/applauncherk...pRunner.py

If you just want to have a link to some program in kodi you can checkout my applauncher plugin
https://github.com/Takezo36/repo/blob/ma...p?raw=true
just deactivate the os listing and add a new custom entry.

Edit:
Wooops small correction i didn't have a problem with runscript but with system.exec. any ways runscript is the wrong thing in the first place. AFAIK it's meant for running python scripts not shell scripts. For shell scripts go for subprocess.popen 
Thanks very much for that Takezo36....I'll give it a try.
Reply

Logout Mark Read Team Forum Stats Members Help
how can I run a command line via a button?0