Ok, so I'm a web developer and I'm not going to lie, rainmeter is unlike anything I've ever used before. Basically I'm displaying a simple expression on a page as a flag. This web page has nothing on it other than "<p>y</p>" or <p>n</p>". All I want to do is have some sort of parsing of that page, then an if/else statement that displays an icon when the condition is "y" and display nothing when "n". I'd like to check for this flag every 10 minutes or so.
Any ideas?
Thanks guys,
Josh
It is currently May 8th, 2024, 11:46 am
Trying to parse a page and display an icon on outcome
-
- Posts: 4
- Joined: April 10th, 2011, 11:19 am
-
- Posts: 4
- Joined: April 10th, 2011, 11:19 am
Re: Trying to parse a page and display an icon on outcome
oh and one other thing, when the icon is up id like to be able to click on it to go to a specific web page
thanks again for who ever can break this down barney style for me
thanks again for who ever can break this down barney style for me
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Trying to parse a page and display an icon on outcome
The following code might get you started:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
[MeasureYN]
Measure=Plugin
Plugin=Webparser.dll
URL=file://#CURRENTPATH#Test.html
RegExp="(?siU)<p>(.*)</p>"
UpdateRate=5
StringIndex=1
Substitute="y":"1","n":"0"
[MeasureTestValue]
Measure=Calc
Formula=[MeasureYN]
DynamicVariables=1
IfEqualValue=1
IfEqualAction=!Execute [!RainmeterShowMeter MeterYes][!RainmeterHideMeter MeterNo]
IfBelowValue=1
IfBelowAction=!Execute [!RainmeterShowMeter MeterNo][!RainmeterHideMeter MeterYes]
[MeterNo]
Meter=Image
ImageName=#CURRENTPATH#No.png
X=0
Y=0
W=32
H=32
LeftMouseUpAction=!Execute ["http://dictionary.reference.com/browse/negative"]
[MeterYes]
Meter=Image
ImageName=#CURRENTPATH#Yes.png
X=0
Y=0
W=32
H=32
Hidden=1
LeftMouseUpAction=!Execute ["http://dictionary.reference.com/browse/positive"]
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Trying to parse a page and display an icon on outcome
The "Barney" level explanation is:
I am using WebParser to read in this case a local file. It can also be a page on the internet, just use URL=http:// instead of file://
I then parse the result with a regular expression RegExp="(?siU)<p>(.*)</p>" which will return the "y" or "n" in a StringIndex. In this case there is only one "capture", so I only need the one measure and the one StringIndex.
I am then using a Rainmeter "Substitute" to change the text values "y" and "n" into numeric values "1" and "0" so I can test the results using a Calc measure.
In the Calc measure, I am using Rainmeter "IfActions" to hide or unhide the appropriate meter based on the result.
Then I have two meters, one hidden by default, which are appropriate for my Yes and No conditions. I have put clickable links to a web page on each to demonstrate how that can be done.
Hope this helps.
I am using WebParser to read in this case a local file. It can also be a page on the internet, just use URL=http:// instead of file://
I then parse the result with a regular expression RegExp="(?siU)<p>(.*)</p>" which will return the "y" or "n" in a StringIndex. In this case there is only one "capture", so I only need the one measure and the one StringIndex.
I am then using a Rainmeter "Substitute" to change the text values "y" and "n" into numeric values "1" and "0" so I can test the results using a Calc measure.
In the Calc measure, I am using Rainmeter "IfActions" to hide or unhide the appropriate meter based on the result.
Then I have two meters, one hidden by default, which are appropriate for my Yes and No conditions. I have put clickable links to a web page on each to demonstrate how that can be done.
Hope this helps.
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Trying to parse a page and display an icon on outcome
Couple of additional notes:
1) The UpdateRate= setting tells WebParser how often to "execute". It is based on a multiplication of this value * the value in Update= in [Rainmeter], in milliseconds. I have my sample set to 5, which translates to 5 seconds. If you are hitting the web, you might want to increase this.
2) If there is any possibility that case is an issue with the "y" and "n", then you can change the substitute to Substitute="y":"1","Y":"1","n":"0","N":"0"
Some references:
http://rainmeter.net/cms/Plugins-WebParser
http://rainmeter.net/cms/Meters-Image
http://rainmeter.net/cms/Measures-IfActions
http://rainmeter.net/cms/MouseActions
http://rainmeter.net/cms/Bangs
1) The UpdateRate= setting tells WebParser how often to "execute". It is based on a multiplication of this value * the value in Update= in [Rainmeter], in milliseconds. I have my sample set to 5, which translates to 5 seconds. If you are hitting the web, you might want to increase this.
2) If there is any possibility that case is an issue with the "y" and "n", then you can change the substitute to Substitute="y":"1","Y":"1","n":"0","N":"0"
Some references:
http://rainmeter.net/cms/Plugins-WebParser
http://rainmeter.net/cms/Meters-Image
http://rainmeter.net/cms/Measures-IfActions
http://rainmeter.net/cms/MouseActions
http://rainmeter.net/cms/Bangs
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Trying to parse a page and display an icon on outcome
P.S. If you think of Rainmeter as a web page, and try to apply HTML/CSS reasoning to it, your head will soon explode and spray brains all over your monitor. Rainmeter is very much its own thing...
-
- Posts: 4
- Joined: April 10th, 2011, 11:19 am
Re: Trying to parse a page and display an icon on outcome
So I made a dir "Rainmeter\Skins\Enigma\Sidebar\YN\" and put a file called "YN.ini" with that code along with the changes to make it work for what I was doing. However I'm not getting anything.
Just to double check my changes (dont worry I wasn't relating this to an markup langs lol, I was trying to approach it more like c# or .net which still didnt do me much good.), but now that i look at your code here the logic makes perfect sense. However I'm obviously doing something wrong as it's not working (nothing even shows up when I load it):
Just to double check my changes (dont worry I wasn't relating this to an markup langs lol, I was trying to approach it more like c# or .net which still didnt do me much good.), but now that i look at your code here the logic makes perfect sense. However I'm obviously doing something wrong as it's not working (nothing even shows up when I load it):
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
;Metadata added by RainBrowser
;http://rainmeter.net/cms/Rainmeter101-EditingSkins
[Metadata]
Name=YN
Config=
Description=Basic Web Parser
Instructions=
Version=1
Tags=
License=
Variant=
Preview=
;End of added Metadata
[MeasureYN]
Measure=Plugin
Plugin=Webparser.dll
URL=http://205designs.com/checkit.html
RegExp="(?siU)<p>(.*)</p>"
UpdateRate=10
StringIndex=1
Substitute="y":"1","n":"0"
[MeasureTestValue]
Measure=Calc
Formula=[MeasureYN]
DynamicVariables=1
IfEqualValue=1
IfEqualAction=!Execute [!RainmeterShowMeter MeterYes][!RainmeterHIdeMeter MeterNo]
IfBelowValue=1
IfBelowAction=!Execute [!RainmeterShowMeter MeterNo][!RainmeterHIdeMeter MeterYes]
[MeterNo]
Meter=Image
ImageName=C:\Users\Administrator\Pictures\icons\blank.png
X=0
Y=0
W=128
H=128
LeftMouseUpAction=!Execute ["http://backend.205designs.com"]
[MeterYes]
Meter=Image
ImageName=C:\Users\Administrator\Pictures\icons\Communication+Internet\email.png
X=0
Y=0
W=128
H=128
Hidden=1
LeftMouseUpAction=!Execute ["http://backend.205designs.com"]
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Trying to parse a page and display an icon on outcome
1) Did you "Refresh All" on the Rainmeter context menu after adding the new skin folder?
2) Are you sure about the locations of those image files?
It all looks ok. It works fine with me using http://205designs.com/checkit.html as the URL= and my images in my skin as I posted it before, so it HAS to be either 1) or 2) above. You might test it by putting the icon images in the same folder with the skin, and using
ImagePath=#CURRENTPATH#blank.png
ImagePath=#CURRENTPATH#email.png
and see if that works.
2) Are you sure about the locations of those image files?
It all looks ok. It works fine with me using http://205designs.com/checkit.html as the URL= and my images in my skin as I posted it before, so it HAS to be either 1) or 2) above. You might test it by putting the icon images in the same folder with the skin, and using
ImagePath=#CURRENTPATH#blank.png
ImagePath=#CURRENTPATH#email.png
and see if that works.
-
- Posts: 4
- Joined: April 10th, 2011, 11:19 am
Re: Trying to parse a page and display an icon on outcome
he he, yeah im an idiot, email.png was actually email.PNG, windows is case sensitive...
So yeah, it was working, just wasnt showing because it wasn't point to what i thought it was pointing so the image wasnt displaying, thanks!
So yeah, it was working, just wasnt showing because it wasn't point to what i thought it was pointing so the image wasnt displaying, thanks!
-
- Posts: 397
- Joined: June 22nd, 2010, 4:11 am
Re: Trying to parse a page and display an icon on outcome
? Windows?? Case Senstive??? Not trying to be mean those two should not belong in the same sentence without some sort of "negative" in it :P
E.G windows is NOT case sensitive.
Morley, is rainmeter case sensitive with extensions? I've never noticed if it is...
E.G windows is NOT case sensitive.
Morley, is rainmeter case sensitive with extensions? I've never noticed if it is...
I have three rules when I'm trying to help you.
- Don't get mad when you don't understand something
- Be VERY specific with what you ask for.
The more specific you are, the higher the quality of support you receive. - Do not just copy and paste what I put in examples and come back saying it doesn't work.
It does work, but I purposely left blanks that you need to fill for your specific needs.