chrdh wrote: ↑May 12th, 2023, 2:21 pm
But another information is important it's if the stuff is in charging mode or not. if i plug my stuff the xml will return a "True" if it dont plug it it will return "False", so i can grab this information with WebParser too, so i get a string with "False" or "True", but the problem is in my skin i get a icon to show if it's a headset, a keyboard or a mouse, and this icon is show by a "Meter=Image ImageName=#@#I\mouse.png" and i would like this image change if the the WebParser return True or False.
First let's clarify a few things: I assume the measure returning true or false is [DEVICEBATTERY]. Is this correct?
If it is, [DEVICESTRING] doesn't work, it can't handle strings (true and / or false). A Calc measure only works with numeric values. But this measure, at least from the point of view of the posted code, isn't even necessary.
Now if the above assumption is correct, here are the solution (both your "options" are possible):
chrdh wrote: ↑May 12th, 2023, 2:21 pm
1st option is to do a condition (i dont know if it's possible) but something like this : if it's true it's ImageName=#@#I\mouse.png and if it's false it's ImageName=#@#I\mouse2.png
Do the followings:
Code: Select all
[DEVICEBATTERY]
Measure=WebParser
URL=[XMLBATTERY]
StringIndex=1
IfMatch=true
IfMatchAction=[!setOption Icon ImageName "#@#I\mouse.png"][!UpdateMeter "Icon"][!Redraw]
IfNotMatchAction=[!setOption Icon ImageName "#@#I\mouse.2png"][!UpdateMeter "Icon"][!Redraw]
If the value returned by the [DEVICEBATTERY] measure is
true, IfMatchAction is executed. The !SetOption bang sets to the ImageName option the
#@#I\mouse.png image. If the measure doesn't match true, IfNotMatchAction is executed and accordingly the image is set to
#@#I\mouse.2png. Note an important thing here: this image setting (mouse2.png) is executed every time the measure doesn't match true. So for false for instance, but same way for any other value returned by the measure, excepting true.
chrdh wrote: ↑May 12th, 2023, 2:21 pm
2nd option is (i dont know if it's possible but) : ImageName=#@#I\[STRING TRUE OR FALSE].png. i try this one but dosnt work.
Add the following Substitute option to the [DEVICEBATTERY] measure:
Substitute="false":"2","true":"". Change the ImageName option of the [Icon] meter to:
ImageName=#@#I\mouse[DEVICEBATTERY].png. Along with this, also add a DynamicVariables=1 option to the [Icon] meter. Make sure not to forget this last option, without it the meter won't show the correct image.
Please check any of the above solution and let me know is does work. Also let me know if I misunderstood your explanation (if for instance not the [DEVICEBATTERY] measure is the one returning true or false).