List of built-in functions: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
>Sho
(Updated according to current SVN (incomplete))
>Sho
(Separated All and Xbox)
Line 1: Line 1:
{{XBMC faq toc Inline}}
{{XBMC faq toc Inline}}
__NOTOC__
__NOEDITSECTION__
__NOEDITSECTION__
The latest up-to-date list of built-in functions can be found in the function '''CBuiltins::Execute()''' in the source code file [http://xbmc.svn.sourceforge.net/viewvc/xbmc/trunk/xbmc/utils/Builtins.cpp?view=markup xbmc/utils/Builtins.cpp].
The latest up-to-date list of built-in functions can be found in the function '''CBuiltins::Execute()''' in the source code file [http://xbmc.svn.sourceforge.net/viewvc/xbmc/trunk/xbmc/utils/Builtins.cpp?view=markup xbmc/utils/Builtins.cpp].
Line 14: Line 13:
*[[Opening Windows and Dialogs]]<br>
*[[Opening Windows and Dialogs]]<br>


 
==All Platforms==
{| class="usertable" border="1"
{| class="usertable" border="1"
|- class="userrow"
|- class="userrow"
Line 27: Line 26:
|- class="userrow"
|- class="userrow"
| class="usercell" | Quit
| class="usercell" | Quit
| class="usercell" |
| class="usercell" | Quits XBMC (same as Dashboard on Xbox)
Quits XBMC (same as Dashboard on Xbox)
|- class="userrow"
| class="usercell" | Dashboard
| class="usercell" |
Runs the dashboard, as specified in the GUI Settings (Xbox specific)
|- class="userrow"
|- class="userrow"
| class="usercell" | Hibernate
| class="usercell" | Hibernate
| class="usercell" |
| class="usercell" | Hibernate (S4) the System (not working on Xbox due to hardware limitations)
Hibernate (S4) the System (not working on Xbox due to hardware limitations)
|- class="userrow"
|- class="userrow"
| class="usercell" | Suspend
| class="usercell" | Suspend
| class="usercell" |
| class="usercell" | Suspends (S3 / S1 depending on bios setting) the System (not working on Xbox due to hardware limitations)
Suspends (S3 / S1 depending on bios setting) the System (not working on Xbox due to hardware limitations)
|- class="userrow"
|- class="userrow"
| class="usercell" | RestartApp
| class="usercell" | RestartApp
Line 55: Line 47:
|- class="userrow"
|- class="userrow"
| class="usercell" | ActivateWindow(window[,dir,return])
| class="usercell" | ActivateWindow(window[,dir,return])
| class="usercell" | 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. [[Window IDs|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 optional dir parameter specifies which folder XBMC should default to once the window is opened. This must be a source as specified in Sources.xml, or a subfolder of a valid source. For some windows (MusicLibrary and VideoLibrary), the return parameter may be specified, which indicates that XBMC should use this folder as the "root" of the level, and thus the "parent directory" action from within this folder will return the user to where they were prior to the window activating.  On xbox, the special command ActivateWindow(MyFiles,autodetection) opens the filemanager with the autodetected xbox in the left hand pane.
| class="usercell" | 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. [[Window IDs|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 optional dir parameter specifies which folder XBMC should default to once the window is opened. This must be a source as specified in Sources.xml, or a subfolder of a valid source. For some windows (MusicLibrary and VideoLibrary), the return parameter may be specified, which indicates that XBMC should use this folder as the "root" of the level, and thus the "parent directory" action from within this folder will return the user to where they were prior to the window activating.  On Xbox, the special command ActivateWindow(MyFiles,autodetection) opens the filemanager with the autodetected Xbox in the left hand pane.
|- class="userrow"
|- class="userrow"
| class="usercell" | ReplaceWindow(window,dir)
| class="usercell" | ReplaceWindow(window,dir)
Line 68: Line 60:
| class="usercell" | RunAppleScript(script[,args]*)
| class="usercell" | RunAppleScript(script[,args]*)
| class="usercell" | RRun the specified AppleScript command
| class="usercell" | RRun the specified AppleScript command
|- class="userrow"
| class="usercell" | RunXBE(xbe)
| class="usercell" | Runs the xbe. Full path must be specified. Only applies to Xbox.
|- class="userrow"
|- class="userrow"
| class="usercell" | RunPlugin(plugin)
| class="usercell" | RunPlugin(plugin)
Line 121: Line 110:
|- class="userrow"
|- class="userrow"
| class="usercell" | Skin.ToggleSetting(setting)
| class="usercell" | Skin.ToggleSetting(setting)
| class="usercell" |Toggles the skin setting ?setting? for use with [[Conditional Visibility|conditional visibility tags]] containing Skin.HasSetting(setting).
| class="usercell" | Toggles the skin setting ?setting? for use with [[Conditional Visibility|conditional visibility tags]] containing Skin.HasSetting(setting).
|- class="userrow"
|- class="userrow"
| class="usercell" | Skin.SetString(string[,value])
| class="usercell" | Skin.SetString(string[,value])
| class="usercell" |Pops up a keyboard dialog and allows the user to input a string which can be used in a label control elsewhere in the skin via the [[InfoLabels|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.
| class="usercell" | Pops up a keyboard dialog and allows the user to input a string which can be used in a label control elsewhere in the skin via the [[InfoLabels|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.
|- class="userrow"
|- class="userrow"
| class="usercell" | Skin.SetNumeric(numeric[,value])
| class="usercell" | Skin.SetNumeric(numeric[,value])
| class="usercell" |Pops up a keyboard dialog and allows the user to input a numerical.
| class="usercell" | Pops up a keyboard dialog and allows the user to input a numerical.
|- class="userrow"
|- class="userrow"
| class="usercell" | Skin.SetPath(string[,value])
| class="usercell" | Skin.SetPath(string[,value])
| class="usercell" |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 [[InfoLabels|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.
| class="usercell" | Pops up a folder browser and allows the user to select a folder of images to be used in a multi image control else where in the skin via the [[InfoLabels|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.
|- class="userrow"
|- class="userrow"
| class="usercell" | Skin.Theme
| class="usercell" | Skin.Theme
| class="usercell" |Cycles the skin theme. Skin.theme(-1) will go backwards.
| class="usercell" | Cycles the skin theme. Skin.theme(-1) will go backwards.
|- class="userrow"
|- class="userrow"
| class="usercell" | Skin.SetImage(string[,value])
| class="usercell" | Skin.SetImage(string[,value])
| class="usercell" |Pops up a file browser and allows the user to select an image file to be used in an image control elsewhere in the skin via the [[InfoLabels|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.
| class="usercell" | Pops up a file browser and allows the user to select an image file to be used in an image control elsewhere in the skin via the [[InfoLabels|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.
|- class="userrow"
|- class="userrow"
| class="usercell" | Skin.SetLargeImage(string[,value])
| class="usercell" | Skin.SetLargeImage(string[,value])
| class="usercell" |Pops up a file browser and allows the user to select an large image file to be used in an image control else where in the skin via the [[InfoLabels|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.
| class="usercell" | Pops up a file browser and allows the user to select an large image file to be used in an image control else where in the skin via the [[InfoLabels|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.
|- class="userrow"
|- class="userrow"
| class="usercell" | Skin.SetFile(string,mask,folderpath)
| class="usercell" | Skin.SetFile(string,mask,folderpath)
| class="usercell" |Pops up a folder browser and allows the user to select a file off the xbox harddisk to be used else where in the skin via the [[InfoLabels|info tag]] Skin.String(string). If the mask parameter is specified, then the file browser will only search for the extension specified (.avi,.mp3,.m3u,.png,.bmp,etc.,etc.). If the folderpath parameter is set the file browser will start in that folder.
| class="usercell" | Pops up a folder browser and allows the user to select a file off the xbox harddisk to be used else where in the skin via the [[InfoLabels|info tag]] Skin.String(string). If the mask parameter is specified, then the file browser will only search for the extension specified (.avi,.mp3,.m3u,.png,.bmp,etc.,etc.). If the folderpath parameter is set the file browser will start in that folder.
|- class="userrow"
|- class="userrow"
| class="usercell" | Skin.SetBool(setting)
| class="usercell" | Skin.SetBool(setting)
| class="usercell" |Sets the skin setting ?setting? to true, for use with the [[Conditional Visibility|conditional visibility tags]] containing Skin.HasSetting(setting). The settings are saved <span class="nobr">per-skin</span> in settings.xml just like all the other XBMC settings.
| class="usercell" | Sets the skin setting ?setting? to true, for use with the [[Conditional Visibility|conditional visibility tags]] containing Skin.HasSetting(setting). The settings are saved <span class="nobr">per-skin</span> in settings.xml just like all the other XBMC settings.
|- class="userrow"
|- class="userrow"
| class="usercell" | Skin.Reset(setting)
| class="usercell" | Skin.Reset(setting)
Line 202: Line 191:
|- class="userrow"
|- class="userrow"
| class="usercell" | Control.Move(id,offset)
| class="usercell" | Control.Move(id,offset)
| class="usercell" |Will make a Container with the "id" specified in the command move focus by "offset".
| class="usercell" | Will make a Container with the "id" specified in the command move focus by "offset".
|- class="userrow"
|- class="userrow"
| class="usercell" | Control.SetFocus(id,position)
| class="usercell" | Control.SetFocus(id,position)
| class="usercell" |Will make a list with the "id" specified in the command gain focus at "postion" number in its list. Alias SetFocus(id,position)
| class="usercell" | Will make a list with the "id" specified in the command gain focus at "postion" number in its list. Alias SetFocus(id,position)
|- class="userrow"
|- class="userrow"
| class="usercell" | Control.Message(id,message,[windowid])
| class="usercell" | Control.Message(id,message,[windowid])
| class="usercell" |Sends a given message to a control in a given window (or active window if omitted). Messages can be movedown, moveup, pagedown, pageup, click.
| class="usercell" | Sends a given message to a control in a given window (or active window if omitted). Messages can be movedown, moveup, pagedown, pageup, click.
|- class="userrow"
|- class="userrow"
| class="usercell" | SendClick(windowid,id)
| class="usercell" | SendClick(windowid,id)
Line 214: Line 203:
|- class="userrow"
|- class="userrow"
| class="usercell" | LoadProfile(profilename)
| class="usercell" | LoadProfile(profilename)
| class="usercell" |Load the specified profile (note; if locks are active it won't work).
| class="usercell" | Load the specified profile (note; if locks are active it won't work).
|- class="userrow"
|- class="userrow"
| class="usercell" | SetProperty(key,value)
| class="usercell" | SetProperty(key,value)
| class="usercell" |Sets a window property for the current window (key,value).
| class="usercell" | Sets a window property for the current window (key,value).
|- class="userrow"
|- class="userrow"
| class="usercell" | PlayWith()
| class="usercell" | PlayWith()
| class="usercell" |Play the selected item with the specified player core.
| class="usercell" | Play the selected item with the specified player core.
|}
 
==Xbox Only==
{| class="usertable" border="1"
|- class="userrow"
| class="usercell" | Dashboard
| class="usercell" |Runs the dashboard, as specified in the GUI Settings (Xbox specific)
|- class="userrow"
| class="usercell" | RunXBE(xbe)
| class="usercell" | Runs the xbe. Full path must be specified (Xbox specific)
|- class="userrow"
|- class="userrow"
| class="usercell" | BackupSystemInfo
| class="usercell" | BackupSystemInfo
| class="usercell" | Creates bios, eeprom, systeminformation backup to /system/systeminfo/ (Xbox only)
| class="usercell" | Creates bios, eeprom, systeminformation backup to /system/systeminfo/ (Xbox specific)
|- class="userrow"
|- class="userrow"
| class="usercell" | System.PWMControl()
| class="usercell" | System.PWMControl()
| class="usercell" | RGB PWM Control for SmartXX v3 and OPX. (Xbox only)
| class="usercell" | RGB PWM Control for SmartXX v3 and OPX (Xbox specific)


system.pwmcontrol(#ColorA,#ColorB,action,xTime)  
system.pwmcontrol(#ColorA,#ColorB,action,xTime)  
Line 238: Line 237:
:#"'''blink'''": will blink from ColorA to ColorB in xTime. A-B-A-B-A-B
:#"'''blink'''": will blink from ColorA to ColorB in xTime. A-B-A-B-A-B
:#"'''switch'''": will switch only once from ColorA to ColorB in xTime  
:#"'''switch'''": will switch only once from ColorA to ColorB in xTime  
:#"'''none'''" or EMPTY: Switch to a Color! Alternate use: '''system.pwmcontrol(#Color)'''  
:#"'''none'''" or EMPTY: Switch to a Color! Alternate use: '''system.pwmcontrol(#Color)'''
|}


[[category:Skin Development]]
[[category:Skin Development]]

Revision as of 19:21, 26 November 2009

Template:XBMC faq toc Inline

The latest up-to-date list of built-in functions can be found in the function CBuiltins::Execute() in the source code file xbmc/utils/Builtins.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>

You can use parameters with all media windows, as can be seen here:

All Platforms

Reboot Cold reboots the system (power cycle)
ShutDown Trigger default Shutdown action defined in System Settings, Default Powerdown on Xbox and Quit on Linux / OSX / Windows
Powerdown Powerdown system
Quit Quits XBMC (same as Dashboard on Xbox)
Hibernate Hibernate (S4) the System (not working on Xbox due to hardware limitations)
Suspend Suspends (S3 / S1 depending on bios setting) the System (not working on Xbox due to hardware limitations)
RestartApp Restarts XBMC
Minimize Minimizes XBMC
Credits Runs the Credits
Mastermode Runs XBMC in master mode
ActivateWindow(window[,dir,return]) 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 optional dir parameter specifies which folder XBMC should default to once the window is opened. This must be a source as specified in Sources.xml, or a subfolder of a valid source. For some windows (MusicLibrary and VideoLibrary), the return parameter may be specified, which indicates that XBMC should use this folder as the "root" of the level, and thus the "parent directory" action from within this folder will return the user to where they were prior to the window activating. On Xbox, the special command ActivateWindow(MyFiles,autodetection) opens the filemanager with the autodetected Xbox in the left hand pane.
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.
TakeScreenshot Takes a Screenshot
RunScript(script[,args]*) Runs the python script. You must specify the full path to the script, (or use Q:\Scripts\Scriptname.py on Xbox). As of 2007/02/24, all extra parameters are passed to the script as arguments and can be accessed by python using sys.argv
RunAppleScript(script[,args]*) RRun the specified AppleScript command
RunPlugin(plugin) Runs the plugin. Full path must be specified. Does not work for folder plugins
Extract Extracts a specified archive to an optionally specified path. ! REQUIRES ABSOLUTE PATHS !
PlayMedia(media) Plays the media. This can be a playlist, music, or video file or an Url
SlideShow(dir [,recursive, [not]random]) Starts a slideshow of pictures in the folder dir. Optional parameters are "recursive", and "random" or "notrandom" parameters. The "recursive" parameter starts a recursive slideshow, adding images from sub-folders. The "random" and "notrandom" parameters override the Randomize setting found in the pictures media window.
RecursiveSlideShow(dir) Run a slideshow from the specified directory, including all subdirs
ReloadSkin() Reloads the current skin – useful for skinners to use after they upload modified skin files (saves power cycling)
RefreshRSS Reload RSS feeds from RSSFeeds.xml
PlayerControl(command) Allows control of music and videos. The command may be one of Play, Stop, Forward, Rewind, Next, Previous, BigSkipForward, BigSkipBackward, SmallSkipForward, SmallSkipBackward, Random, RandomOn, RandomOff, Repeat, RepeatOne, RepeatAll, RepeatOff, Partymode(music) or Partymode(video) or Partymode(path to .xsp file), and Record. Play will either pause, resume, or stop ffwding or rewinding. Random toggles random playback, Repeat cycles through the repeat modes, Partymode(music/video) toggles the appropriate partymode, defaults to music if no parameter is given, besides the default music or video partymode you can also pass a path to a custom smartplaylist (.xsp) as parameter. Record will work to record shoutcast streams (only?).
Playlist.PlayOffset Start playing from a particular offset in the playlist
Playlist.Clear Clear the current playlist
EjectTray() Either opens or closes the DVD tray, depending on its current state
AlarmClock(name,command,time[,silent]) 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. Set silent to true to hide the alarm notification.
CancelAlarm(name) Cancel a running alarm
Action Executes an action for the active window (same as in keymap)
Notification(header,message[,time,image]) Will display a notification dialog with the specified header and message, in addition you can set the length of time it displays in milliseconds and a icon image.
PlayDVD Will play the inserted CD or DVD media from the DVD-ROM drive.
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 elsewhere 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.SetNumeric(numeric[,value]) Pops up a keyboard dialog and allows the user to input a numerical.
Skin.SetPath(string[,value]) Pops up a folder browser and allows the user to select a folder of images 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.SetImage(string[,value]) Pops up a file browser and allows the user to select an image file to be used in an image control elsewhere 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.SetLargeImage(string[,value]) Pops up a file browser and allows the user to select an large image file 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.SetFile(string,mask,folderpath) Pops up a folder browser and allows the user to select a file off the xbox harddisk to be used else where in the skin via the info tag Skin.String(string). If the mask parameter is specified, then the file browser will only search for the extension specified (.avi,.mp3,.m3u,.png,.bmp,etc.,etc.). If the folderpath parameter is set the file browser will start in that folder.
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.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.)
Mute Mutes (or unmutes) the volume.
SetVolume(percent) Sets the volume to the percentage specified.
Dialog.Close(dialog[,force]) Close a dialog. Set force to true to bypass animations.
System.LogOff Log off current user.
System.Exec Execute shell commands.
System.ExecWait Execute shell commands and freezes XBMC until shell is closed.
Resolution Change XBMC's Resolution.
UpdateLibrary(database,[path]) Takes either "video" or "music" as a parameter to begin updating the corresponding database. For "video" you can additionally specify a specific path to be scanned.
CleanLibrary This funtion will perform a number of 'cleanup' tasks on your video database and can be run if you have moved, deleted or renamed files.
PageDown Send a page down event to the pagecontrol with given id.
PageUp Send a page up event to the pagecontrol with given id.
LastFM.Love All songs that can be submitted to Last.fm can be loved, optional parameter (false) = direct loving without confirmationdialog.
LastFM.Ban Only songs that are playing on last.fm radio can be banned, optional parameter (false) = direct banning without confirmationdialog.
Container.SetViewMode(id) Set the current view mode (list, icons etc.) to the given container id.
Container.NextViewMode Select the next view mode.
Container.PreviousViewMode Select the previous view mode.
Control.Move(id,offset) Will make a Container with the "id" specified in the command move focus by "offset".
Control.SetFocus(id,position) Will make a list with the "id" specified in the command gain focus at "postion" number in its list. Alias SetFocus(id,position)
Control.Message(id,message,[windowid]) Sends a given message to a control in a given window (or active window if omitted). Messages can be movedown, moveup, pagedown, pageup, click.
SendClick(windowid,id) Sends a click to a control in a given window (or active window if omitted).
LoadProfile(profilename) Load the specified profile (note; if locks are active it won't work).
SetProperty(key,value) Sets a window property for the current window (key,value).
PlayWith() Play the selected item with the specified player core.

Xbox Only

Dashboard Runs the dashboard, as specified in the GUI Settings (Xbox specific)
RunXBE(xbe) Runs the xbe. Full path must be specified (Xbox specific)
BackupSystemInfo Creates bios, eeprom, systeminformation backup to /system/systeminfo/ (Xbox specific)
System.PWMControl() RGB PWM Control for SmartXX v3 and OPX (Xbox specific)

system.pwmcontrol(#ColorA,#ColorB,action,xTime)

  1. ColorA & ColorB: #rrggbb-> from #000000 up to #FFFFFF [e.g. #FF0000 is Red, ##FFC0CB is Pink..]
  2. xTime: in msec, 0=off min.=1 max.=no max limit
  3. action:
  1. "fade": will fade only once in xTime, from ColorA to ColorB! A->B
  2. "fadeloop": will fade in loop in xTime, from ColorA to ColorB! A->B, A->B, A->B
  3. "faderepeat": will repeat fade (ping-pong) in xTime steps, from ColorA to ColorB. A<->B
  4. "blink": will blink from ColorA to ColorB in xTime. A-B-A-B-A-B
  5. "switch": will switch only once from ColorA to ColorB in xTime
  6. "none" or EMPTY: Switch to a Color! Alternate use: system.pwmcontrol(#Color)