Run script from menu

Hello,

I’m trying to create a menu shortcut to run a script. I think I’ve followed the instructions here but i still can’t get it to work.

I’ve set up my menu item through the configure skin menu, but i’ve pasted an exert from /home/osmc/.kodi/userdata/addon_data/script.skinshortcuts/mainmenu.DATA.xml to let you see my config

        <shortcut>
                <defaultID>13000</defaultID>
                <label>Enable VPN</label>
                <label2>Custom item</label2>
                <icon>SystemSettings.png</icon>
                <thumb />
                <action>XBMC.RunScript(/home/osmc/script.py)</action>
                </shortcut>
        <shortcut>

Whenever i try to run it i get the following error.

2022-06-02 21:52:56.061 T:464     ERROR <general>: Keymapping error: no such action 'xbmc.runscript(/home/osmc/script.py)' defined

Hopefully it’s just something silly I’m missing. I’d be grateful for any help :slight_smile:

Take out the XBMC. in the action. With Kodi 18 the XBMC prefix was depreciated, and with Kodi 19 it was removed. So now it’s just RunScript()

4 Likes

Also don’t forget to set an executable permission as this action requires it.

You can also test this outside of the other Kodi mods with…

Kodi-send -a "runscript(/home/osmc/script.py)"

1 Like