List of built-in functions

From Official Kodi Wiki
Revision as of 11:41, 7 September 2006 by Scape (talk)
Jump to: navigation, search

An up to date list of built-in functions can be found in the function CUtil::ExecBuiltIn() in the source code file xbmc/Util.cpp.

In addition to the following list, for most <onclick> and <onfocus> button actions in the skin you can also use the functions from Keymap.xml.
Example:
<onclick>VolumeUp</onclick>
<onclick>VolumeDown</onclick>


XBMC.Reboot Cold reboots the xbox (power cycle)
XBMC.Restart Cold reboots the xbox (power cycle)
XBMC.ShutDown Turns off the xbox
XBMC.Dashboard

Runs the dashboard, as specified in the GUI Settings

XBMC.RestartApp Restarts XBMC
XBMC.Credits Runs the Credits
XBMC.Reset Warm reboots the xbox
XBMC.ActivateWindow(window,dir)

Opens the given window. The parameter window can either be the window's id, or in the case of a standard window, the window's name. See here for a list of window names, and their respective ids. If, furthermore, the window is Music, Video, Pictures, or Program files, then the dir parameter specifies which folder XBMC should default to once the window is opened. This must be a <bookmark> as specified in Sources.xml, or a subfolder of a valid bookmark. Lastly, the special command XBMC.ActivateWindow(MyFiles,autodetection) opens the filemanager with the autodetected xbox in the left hand pane.

XBMC.ReplaceWindow(window,dir) Replaces the current window with the given window. This is the same as ActivateWindow() but it doesn't update the window history list, so when you go back from the new window it will not return to the previous window, rather will return to the previous window's previous window.
XBMC.RunScript(script) Runs the python script. You must specify the full path to the script, or use Q:\Scripts\Scriptname.py.
XBMC.RunXBE(xbe) Runs the xbe. Full path must be specified.
XBMC.PlayMedia(media) Plays the media. This can be a playlist, music, or video file or an Url.
XBMC.SlideShow(dir) Starts a slideshow of pictures in the folder dir.
XBMC.RecursiveSlideShow(dir) Starts a recursive slideshow (including any images in subfolders) of the folder dir.
XBMC.ReloadSkin() Reloads the current skin – useful for skinners to use after they upload modified skin files (saves power cycling).
XBMC.PlayerControl(command) Allows control of music + videos. The command may be one of Play, Stop, Forward, Rewind, Next, Previous, BigSkipForward, BigSkipBackward, SmallSkipForward, SmallSkipBackward, Random, Repeat, RepeatOne, RepeatAll, RepeatOff, Partymode. Play will either pause, resume, or stop ffwding or rewinding. Random toggles random playback, Repeat cycles through the repeat modes, Partymode toggles partymode.
XBMC.EjectTray() Either opens or closes the DVD tray, depending on it's current state.
XBMC.AlarmClock(name,command,time) Pops up a dialog asking for the length of time for the alarm (unless the parameter time is specified), and starts a timer. When the timer runs out, it'll execute the built-in command (the parameter command) if it is specified, otherwise it'll pop up an alarm notice.
XBMC.CancelAlarm(name) Cancel a running alarm.
XBMC.Notification(header,message) Will display a notification dialog with the specified header and message.
XBMC.PlayDVD Will play the inserted CD or DVD media from the DVD-ROM drive.
Skin.SetBool(setting)

Sets the skin setting “setting” to true, for use with the conditional visibility tags containing Skin.HasSetting(setting). The settings are saved per-skin in settings.xml just like all the other XBMC settings.

Skin.ToggleSetting(setting)

Toggles the skin setting “setting” for use with conditional visibility tags containing Skin.HasSetting(setting).

Skin.SetString(string[,value])

Pops up a keyboard dialog and allows the user to input a string which can be used in a label control else where in the skin via the info tag Skin.String(string). If the value parameter is specified, then the keyboard dialog does not pop up, and the string is set directly.

Skin.SetImage(string[,value])

Pops up a file browser and allows the user to select an image file off the xbox harddisk to be used in an image control else where in the skin via the info tag Skin.String(string). If the value parameter is specified, then the file browser dialog does not pop up, and the image path is set directly.

Skin.SetPath(string[,value])

Pops up a folder browser and allows the user to select a folder of images off the xbox harddisk to be used in a multi image control else where in the skin via the info tag Skin.String(string). If the value parameter is specified, then the file browser dialog does not pop up, and the path is set directly.

Skin.theme

Cycles the skin theme. Skin.theme(-1) will go backwards.

Skin.Reset(setting) Resets the skin setting “setting”. If “setting” is a bool setting (ie set via SetBool or ToggleSetting) then the setting is reset to false. If “setting” is a string (Set via SetString, SetImage, or SetPath) then it is set to empty.
Skin.ResetSettings Resets all the above skin settings to their defaults (toggles all set to false, strings all set to empty.)
XBMC.Takescreenshot Takes a Screenshot.
XBMC.SetVolume(percent) Sets the volume to the percentage specified.
XBMC.Mute Mutes (or unmutes) the volume.
XBMC.Extract Extracts a specified archive to an optionally specified path. ! REQUIRES ABSOLUTE PATHS !
Dialog.Close(dialog[,force]) Close a dialog. Set force to true to bypass animations.
System.LogOff Log off current user.
XBMC.System.PWMControl() RGB PWM Control for SmartXX v3 and OPX. XBMC.system.pwmcontrol(#rrggbb,#rrggbb,action,time) #rrggbb-> from #000000 up to #ffffff [e.g. #ff0000 is Red, ##FFC0CB is Pink.. and so on] action-> [from first #rrggbb to second #rrggbb]cur. supportted actions are: switch , blink, fade, fadeloop. time-> time in ms for the actions! e.g.: this will blink BLUE: XBMC.system.pwmcontrol(#0000FF,#000000,blink,50)