linux run shell script from menu...so simple?
#1

hello,

i've been googling for ages...im going around in circles.

please help.

i want to run a shell script or python which ever from a menu item somewhere.

i've tried advanced launcher...it didn't work.

please help.
Reply
#2
system.exec / system.execbg builtins.
Reply
#3

can i just wack that into a py file and run it out of the file manager?

Reply
#4
well yes, that would be an impractical way of doing it (using xbmc.executeBuiltin). you can also bind a key or put a button in the skin.
Reply
#5

oh got it working...new problem.

i was hoping that i would be able to run this script using the iphone / ipad app but i don't seem to have access to scripts in the app? anyone know how to get them?

i'm trying to turn on a projector...i've got the on / off commands and some rough python / shell to make it work but now i think i can use it...sigh.
Reply
#6
(2012-09-18, 08:42)xbmcn00b Wrote: hello,

i've been googling for ages...im going around in circles.

please help.

i want to run a shell script or python which ever from a menu item somewhere.

i've tried advanced launcher...it didn't work.
To start a shell script command line is generally :

Code:
/bin/sh /path/to/the/script.sh

or

Code:
/usr/bin/python /path/to/the/script.py

So into advanced launcher you need to create a stand alone launcher and select /bin/sh or /usr/bin/python as application and indicate /path/to/the/script.sh or /path/to/the/script.py as arguments.

If you plan to start several sh scripts or (python scripts) the best move is to put all your script into the same directory and create a file launcher and configure it like this :

application: /bin/sh (or /usr/bin/python)
item path: /path/to/the/scripts/
arguments: "%rom%"
file extension: sh (or py)
Reply
#7
I'm Hijacking a few months old thread here, but my problem is the same so it seems daft to start another...

When trying to find a solution to running shell or python scripts from the XMBC interface the following solution was given.

(2012-09-18, 19:24)Angelscry Wrote: So into advanced launcher you need to create a stand alone launcher and select /bin/sh or /usr/bin/python as application and indicate /path/to/the/script.sh or /path/to/the/script.py as arguments.

If you plan to start several sh scripts or (python scripts) the best move is to put all your script into the same directory and create a file launcher and configure it like this :

[b]application:
/bin/sh (or /usr/bin/python)item path: /path/to/the/scripts/
arguments: "%rom%"
file extension: sh (or py)[/b]

This would be perfect for what I want to do with a lot of VPN scripts, the instructions are really clear to me, but it just doesn't work for me in Frodo. All my scripts run perfectly when I SSH in, whether I use '/bin/sh /home/pi/myvpn.sh ' or if I chmod 755 them and run './myvpn'.

Through the XBMC menu I previously had the same "Script Failed! : add-on.py" others in my searches were having. Using this alternative technique (highlighted in blue) I get "Working.." Then nothing, no list of scripts to run.

I'm using XBMC 12.0Beta3 Git:20121209-7f49891
Advanced Launcher 1.7.6 downloaded from the XBMC 12Beta version's built in Addons repository. (Update Option appears Greyed out)

Is this a Frodo thing? If so Is there a solution or an alternative method to getting these VPNs from the XBMC interface?

Is 1.7.6 the latest version of Advanced Launcher under Frodo? If not what repository do I need to install to get a newer version?

I've only has a Raspberry Pi for a couple of days and already have BBC iPlayer, DVBLogic LiveTV sussed and VPNs sorted (sort of), I just can't work out how to launch the VPN scripts from the XMBC interface.

Any help appreciated,

Thanks Smile
Reply
#8
(2012-12-11, 20:48)MacOCD Wrote: I'm Hijacking a few months old thread here, but my problem is the same so it seems daft to start another...

When trying to find a solution to running shell or python scripts from the XMBC interface the following solution was given.

(2012-09-18, 19:24)Angelscry Wrote: So into advanced launcher you need to create a stand alone launcher and select /bin/sh or /usr/bin/python as application and indicate /path/to/the/script.sh or /path/to/the/script.py as arguments.

If you plan to start several sh scripts or (python scripts) the best move is to put all your script into the same directory and create a file launcher and configure it like this :

[b]application:
/bin/sh (or /usr/bin/python)item path: /path/to/the/scripts/
arguments: "%rom%"
file extension: sh (or py)[/b]

This would be perfect for what I want to do with a lot of VPN scripts, the instructions are really clear to me, but it just doesn't work for me in Frodo. All my scripts run perfectly when I SSH in, whether I use '/bin/sh /home/pi/myvpn.sh ' or if I chmod 755 them and run './myvpn'.

Through the XBMC menu I previously had the same "Script Failed! : add-on.py" others in my searches were having. Using this alternative technique (highlighted in blue) I get "Working.." Then nothing, no list of scripts to run.

I'm using XBMC 12.0Beta3 Git:20121209-7f49891
Advanced Launcher 1.7.6 downloaded from the XBMC 12Beta version's built in Addons repository. (Update Option appears Greyed out)

Is this a Frodo thing? If so Is there a solution or an alternative method to getting these VPNs from the XBMC interface?

Is 1.7.6 the latest version of Advanced Launcher under Frodo? If not what repository do I need to install to get a newer version?

I've only has a Raspberry Pi for a couple of days and already have BBC iPlayer, DVBLogic LiveTV sussed and VPNs sorted (sort of), I just can't work out how to launch the VPN scripts from the XMBC interface.

Any help appreciated,

Thanks Smile
I think your problem come to the fact that you are using an old and deprecated version of Advanced Launcher. Version 1.7.6 is 10 months old and not compatible with last XBMC Frodo releases. Nearly 30 different versions of Advanced Launcher have been released since. The latest version of Advanced Launcher is 1.10.7. I strongly suggest you to install my repository to have Advanced Launcher updated regularly.
Reply
#9
(2012-12-11, 21:00)Angelscry Wrote: I think your problem come to the fact that you are using an old and deprecated version of Advanced Launcher. Version 1.7.6 is 10 months old and not compatible with last XBMC Frodo releases. Nearly 30 different versions of Advanced Launcher have been released since.

I had a suspicion that I may be using an out of date version, I installed Advanced Launcher directly from within Frodo and the option to update was greyed out. I thought the version that XBMC12 has in it's repository would be compatible with XBMC12, not an unreasonable assumption. I took the 'Eden Only' warning to mean prior XBMC iterations before Eden were not compatible.

Quote:The latest version of Advanced Launcher is 1.10.7. I strongly suggest you to install my repository to have Advanced Launcher updated regularly.

Now I know your repository location I've installed it and I'm using 1.10.7, thanks Smile

My individual scripts are now working, although the technique you suggested previously for selecting from multiple scripts doesn't seem to list any scripts to choose. My scripts are located in the /home/pi/ folder, I renamed them with a .sh extension and added sh AND .sh to the Modify Items extensions setting.

But I'm happy that I can select my individual VPNs now, I'll just make a different launcher for each of them and add them all to favourites.

Thanks.
Reply
#10
(2012-12-11, 22:14)MacOCD Wrote:
(2012-12-11, 21:00)Angelscry Wrote: I think your problem come to the fact that you are using an old and deprecated version of Advanced Launcher. Version 1.7.6 is 10 months old and not compatible with last XBMC Frodo releases. Nearly 30 different versions of Advanced Launcher have been released since.

I had a suspicion that I may be using an out of date version, I installed Advanced Launcher directly from within Frodo and the option to update was greyed out. I thought the version that XBMC12 has in it's repository would be compatible with XBMC12, not an unreasonable assumption. I took the 'Eden Only' warning to mean prior XBMC iterations before Eden were not compatible.

Quote:The latest version of Advanced Launcher is 1.10.7. I strongly suggest you to install my repository to have Advanced Launcher updated regularly.

Now I know your repository location I've installed it and I'm using 1.10.7, thanks Smile

My individual scripts are now working, although the technique you suggested previously for selecting from multiple scripts doesn't seem to list any scripts to choose. My scripts are located in the /home/pi/ folder, I renamed them with a .sh extension and added sh AND .sh to the Modify Items extensions setting.

But I'm happy that I can select my individual VPNs now, I'll just make a different launcher for each of them and add them all to favourites.

Thanks.
I have just created and tested an .sh script launcher and it works perfectly. I have create several .sh scripts (make them excutable) and put all of them into the same directory. Then I have created a file launcher like this :

Application : /bin/sh
Argument : "%rom%"
File path : directory where are located the created .sh scripts.
File extension : sh

Then into Advanced Launcher settings put "Collecting Method" to none for Data, Thumbs and Fanarts Scan Settings. Finally select "Add Items" menu entry and choose "Scan for new items" option. All your .sh script must have been added. Select one of them to start your scripts.
Reply
#11
(2012-12-12, 05:11)Angelscry Wrote: I have just created and tested an .sh script launcher and it works perfectly. I have create several .sh scripts (make them excutable) and put all of them into the same directory. Then I have created a file launcher like this :

Application : /bin/sh
Argument : "%rom%"
File path : directory where are located the created .sh scripts.
File extension : sh

Then into Advanced Launcher settings put "Collecting Method" to none for Data, Thumbs and Fanarts Scan Settings. Finally select "Add Items" menu entry and choose "Scan for new items" option. All your .sh script must have been added. Select one of them to start your scripts.

The missing bit for me was 'Add Items -> Scan for new items'. All working as expected now, I did also need to toggle XMBC Fullscreen to OFF to prevent weird display issues.

thanks Smile

Mark.

Reply
#12
Perfect !!! Rofl
Reply
#13
Hi

Would it be possible to put up a sample launchers.xml file as I am drawing a bit of a blank. I says working but nothing happens.

Many thanks

Rob
Reply
#14
(2013-03-02, 19:51)robbieb43 Wrote: Hi

Would it be possible to put up a sample launchers.xml file as I am drawing a bit of a blank. I says working but nothing happens.

Many thanks

Rob
You don't need to edit the launchers.xml file. You can do all automatically from XBMC/Advanced Launcher GUI.
Reply
#15
Thanks Angelscry, I wondered if that may be the case - except it does not prompt me to do that now. I think I am going for a fresh install as it did the first time I used it. However, I still had a problem mapping the instructions for the general pupose shell script launcher to the attribute names in the post - have there been any changes since these instructions were set out?

Sorry for being a numpty here :-(
Reply



Logout Mark Read Team Forum Stats Members Help
linux run shell script from menu...so simple?0
This forum uses Lukasz Tkacz MyBB addons.