It is currently September 30th, 2024, 1:21 am

Display image(s) based on contents of XML file?

General topics related to Rainmeter.
User avatar
jsmorley
Developer
Posts: 22793
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Display image(s) based on contents of XML file?

Post by jsmorley »

OffLight.png is just a image I used for the "starting" image, one to display when the skin is first refreshed or loaded and before the WebParser measure and Calc measure have done their thing. It's not required in any way, as the Calc measure is going to set the image on that meter to either RedLight or GreenLight depending on what the WebParser measure gets as a result.

You can even just leave ImageName off of the meter completely if you want. Then you will just get no image at all until it is set by the IFActions on the Calc measure.
darcilicious
Posts: 34
Joined: May 1st, 2010, 5:34 pm

Re: Display image(s) based on contents of XML file?

Post by darcilicious »

You can even just leave ImageName off of the meter completely if you want. Then you will just get no image at all until it is set by the IFActions on the Calc measure.
Perfect! I'm testing now but it seems to be working like a charm! The System Message part should be easy after this, thanks again SO much!
User avatar
jsmorley
Developer
Posts: 22793
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Display image(s) based on contents of XML file?

Post by jsmorley »

Glad to help.
darcilicious
Posts: 34
Joined: May 1st, 2010, 5:34 pm

Re: Display image(s) based on contents of XML file?

Post by darcilicious »

Well, mostly there but not quite...

This is what I have currently:

Code: Select all

[mRecordingStatus]
Measure=Plugin
Plugin=WebParser
URL=#SystemStatusUrl#
;update recording and system status every minute
UpdateRate=60
RegExp="(?siU).*<Title>(.*)</Title>"
StringIndex=1
Substitute="":"-1"
FinishAction=!EnableMeasure mCheckRecordingStatus
;Debug=1

[mCheckRecordingStatus]
Measure=Calc
Formula=[mRecordingStatus]
IfEqualValue=-1
IfEqualAction=!SetOption MeterRecording ImageName "OSDRecordTinyOFF.png"
IfAboveValue=-1
IfAboveAction=!SetOption MeterRecording ImageName "OSDRecordTiny.png"
DynamicVariables=1
Disabled=1

[MeterRecording]
Meter=Image
X=0
Y=4
This is what is showing up in the log (w/o the WebParser debug enabled) when there's an active recording:

ERRO (15:42:18.990) Calc: "Cycling" is unknown in [mCheckRecordingStatus]

What's happening is that the recording button will go OFF once it's ON but it will never go ON unless I force a refresh of the skin. What it's ON, it's fine and like I said, it will go OFF when the recording stops or is canceled but never goes ON without manually refreshing...

I can send along the WebParser debug entries if that's helpful.
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: Display image(s) based on contents of XML file?

Post by MerlinTheRed »

I can imagine two scenarios here:

1. You indeed have a title tags in there and their content is "Cycling", even if it's not running.
2. The RegExp doesn't match anything when title isn't present and instead of returning the empty string, it returns the last valid value that was matched.

In the latter case you will have to adapt your RegExp to correctly return an empty string if the tags are not found. If you don't, the WebParser will complain about "Not enough substrings" or something. You can find out more about this here: http://rainmeter.net/cms/Tips-LookAhead
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
User avatar
jsmorley
Developer
Posts: 22793
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Display image(s) based on contents of XML file?

Post by jsmorley »

The RegExp is fine. I tested it before I gave it to him, and with that limited one it in fact returns "" if <Title> is not present.

You might try adding a ForceReload=1 to the WebParser measure before you go down any other rabbit holes, to be sure that WebParser is detecting the change to the XML file properly.
darcilicious
Posts: 34
Joined: May 1st, 2010, 5:34 pm

Re: Display image(s) based on contents of XML file?

Post by darcilicious »

Added that and I'm seeing the same behavior, the ON image isn't automatically displayed. This is what the logs show with an active recording:

DBUG (16:22:30.937) WebParser.dll: [mRecordingStatus] (Index 1) The Wedding Singer
ERRO (16:22:31.904) Calc: "The" is unknown in [mCheckRecordingStatus]

Which doesn't display the RecordingON image until I refresh the skin.

This is what the logs show when there's no recording:

ERRO (16:21:30.066) WebParser.dll: [mRecordingStatus] Matching error! (-1)

And that seems to work fine as the RecordingOFF image is displayed with next update / file read.

I'm still trying to wrap my head around AboveAction and AboveValue functions so I'm not much help trying to debug if those are set up correctly...


Thanks again!

P.S. the log entries for the WebParser are the same regardless if the measure is doing the update, or if I manually refresh the skin (if that's worthwhile info or not, I don't know)
User avatar
jsmorley
Developer
Posts: 22793
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Display image(s) based on contents of XML file?

Post by jsmorley »

Make a .zip of your skin and if possible text files of the "with title" and "without title" XML files you are parsing, and attach the .zip here. I'll dig into it a bit deeper.
darcilicious
Posts: 34
Joined: May 1st, 2010, 5:34 pm

Re: Display image(s) based on contents of XML file?

Post by darcilicious »

Okay dokay...
Last edited by darcilicious on September 16th, 2012, 7:01 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22793
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Display image(s) based on contents of XML file?

Post by jsmorley »

Yeah, I'm not too worried about the error log for Calc. That is due to it trying to convert "Debby Does Dallas" into a number and failing. That is ok, as then the measure has a value of "0", which is what we want. We can deal with that with a LookAhead as Merlin says, but that isn't the root of why you are having issues.