Sending arguments to scripts integrated into skins
#1
Alot of skins are now integrating python scripts to change things normally not possible (ie change font color or swapping the splash screen). A problem though is that the script has to put up its own gui to present the user with a selection or whatever (like a choice of font colors).

In Rev 5908 I added the ability to send arguments to scripts via the XBMC.RunScript builtin. This means instead of

Code:
<onclick>XBMC.RunScript(Q:\skin\Project Mayhem III\extras\fontcolor.py)</onclick>

which makes the script bring up its own GUI, you can just have a button in the skin call:

Code:
<onclick>XBMC.RunScript(Q:\skin\Project Mayhem III\extras\fontcolor.py,FFFF00FF)</onclick>

And have the script just process the color from the argument.

This should simplify the python alot and keep the GUI in the skin where it belongs and is easy to change.

Scripters can follow the following guide on the wiki to using arguments http://www.xboxmediacenter.com/wiki/inde..._Arguments

Skinners should take note of the updated XBMC.RunScript definition here
http://www.xboxmediacenter.com/wiki/inde..._Functions
Reply
#2
This addition is great, but it breaks sys.path[0] when launching a script from another script.

If any scripts use sys.path[0], they need to switch to:
os.getcwd().replace( ";", "" ).
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#3
Are you saying that sys.path is set when launching a script from
xbmc.runscript(script)
but not from
xbmc.executebuiltin("XBMC.RunScript("+script+")")
? Really os.getcwd is what you want I think. But yeah I expect for this to be the most useful for skins that talk to scripts...
Reply

Logout Mark Read Team Forum Stats Members Help
Sending arguments to scripts integrated into skins0