Kodi Community Forum

Full Version: Window Properties manipulated as numericals values (increment / decrement etc)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Not sure if this has come up before. Googling didn't yield much.

I'd like to manipulate a property that is treated in script as a numerical.

Currently I call the script with an added fudge factor in sys.argv to increment or decrement the property.

This kind of feels a bit squiffy.

It would be better if I could just do it in the skin:

Code:
<onclick>SetProperty(XXX, Window.Property(XXX) + 1</onclick>

Is it possible?
nope.
Yeah I thought not. Script butchery it is.
Solution:

Code:
    <control type="button" id="2000">
        <onright>SetProperty(Button, $VAR[IncrementButton])</onright>
    </control>
.
.
.
    <variable name="IncrementButton">
        <value condition="StringCompare(Window.Property(Button),0)">1</value>
        <value condition="StringCompare(Window.Property(Button),1)">2</value>
        <value condition="StringCompare(Window.Property(Button),2)">3</value>
        <value condition="StringCompare(Window.Property(Button),3)">4</value>
        <value condition="StringCompare(Window.Property(Button),4)">4</value>
    </variable>

    <variable name="DecrementButton">
        <value condition="StringCompare(Window.Property(Button),0)">0</value>
        <value condition="StringCompare(Window.Property(Button),1)">0</value>
        <value condition="StringCompare(Window.Property(Button),2)">1</value>
        <value condition="StringCompare(Window.Property(Button),3)">2</value>
        <value condition="StringCompare(Window.Property(Button),4)">3</value>
    </variable>

Tested working in Frodo.

Only works if you know the range, and the range is reasonably finite.