I'm making a skin that currently has 10 button images that all do the same thing, except with a different parameter (I'm using this to control my smart lights, so the button will run a python script with a different parameter). The way I'm doing this is a Measure for each button image, and on click each one will set a variable to a specific value (0 for the first one, then increasing until 254 for the last), and after setting the variable THEN run the python script. This is the code I'm using:
Code: Select all
[Variables]
ButtonWidth=1000
ButtonHeight=100
ButtonSpacing=35
Brightness=0
[MeasureRun]
DynamicVariables=1
Measure=Plugin
Plugin=RunCommand
Program=bash
StartInFolder="C:/devlibs/Lights/pytradfri-master"
Parameter=-ic "python3 control.py "#Brightness#
State=Hide
[MeterLight0]
Meter=Button
DynamicVariables=1
ButtonImage=#@#Images/Bulb2.png
ButtonCommand= [!SetVariable Brightness "0"] [!CommandMeasure MeasureRun "Run"]
W=#ButtonWidth#
H=#ButtonHeight#
x=0
y=0
With MeterLight repeated 10 times with different values for Brightness.
The problem I'm having is that the button command runs the SetVariable after the command, no matter the order. In practice this means when I click a button it sets the brightness to that of the last button I pressed. Any solutions? Also, this is the first skin I'm making, so any suggestions for the whole scheme (i.e. a better way of doing it than 10 images) are also appreciated.