Built-in scripting: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
>DonJ
No edit summary
>Gamester17
No edit summary
Line 32: Line 32:


===[[FTP Site Commands]]===
===[[FTP Site Commands]]===
[[category:Inner Workings]]
[[category:Development]]
[[category:Development]]
[[category:Skin Development]]
[[category:Skin Development]]

Revision as of 07:40, 14 May 2007

XBMC contains several built-in functions that can be accessed from the skin (via a button) or from within a python script, or from a press of a button on the remote, gamepad, or keyboard.

Using Built-in Functions from the skin

To have a button (or toggle button) on the skin run a particular function, you just have to add an <onclick> tag (or <onfocus> tag) containing the function you wish to run. For example, adding

 <onclick>XBMC.PlayerControl(Stop)</onclick>

to a button control will create a stop button.


Using Built-in Functions from python

To run a built-in XBMC function from within a python script, you just need to call executebuiltin() with the function name. For example,

 executebuiltin('XBMC.RunScript(Q:\Scripts\myscript.py)')

will run the script myscript.py located in the Scripts directory.


Using Built-in Functions from keymap.xml

To bind a built-in function to a particular key, you just add the built-in command to the appropriate section and button in keymap.xml

For example, to map the running of an executeable to the BLACK button, we'd add: <xml>

 <gamepad>
   ...
   <black>XBMC.RunXBE(E:\Apps\AVALaunch.xbe)</black>
   ...
 </gamepad>

</xml> to whatever window section of keymap.xml is appropriate.
For more information on changing the keymapping with keymap.xml see: Changing the keymapping

List of Built In Functions

Using Built-in Functions from the Web Server (HTTPAPI)

FTP Site Commands