It is currently April 3rd, 2020, 11:29 am

Creating a skin that displays text from a reference manual

Help with creating, editing & fixing problems with skins
User avatar
CieroCeramics
Posts: 4
Joined: March 19th, 2020, 11:08 pm

Creating a skin that displays text from a reference manual

Post by CieroCeramics »

ok so I am not necessarily new to rainmeter, more of a casual rainmeter enthusiast. up until this point I have been downloading skins on deviant art and editing the .ini files to achieve my desired desktop, now I have a skin that I really want to exist and I think I can make it happen but it depends on a few things.

First of all the skin I want to create will allow for a (probably very specific) search in a specified documentation repository,
docs.microsoft, docs.rainmeter, etc... and then display the associated text from that search in a Rainmeter text display skin.
for example if I search "webparser" in a skin titled "Rainmeter Documentation"

it should return the plain text from the website,
https://docs.rainmeter.net/manual/measures/webparser/
and display it in a window that allows scrolling.

now, here are the things I do understand.
reading text in a scrollable window is super possible, so is parsing web data.
doing the search function to a specific web directory shouldn't be a problem for rainmeter. theoretically I could just have the search open a web browser with my desired page and call it a day, but I am looking for something more elegant.
documentation repos tend to be fairly static and don't rely on much more than a few text elements to promote readability.
what I don't understand-
I am unclear on weather regex is able to read through and html file and sort through the proper elements. word on the street is if you try to convert html pages using regex, you're going to have a bad time. I know there is some pretty cool technology that can make the text in to a more regex friendly format, but I don't know where to start with making rainmeter do the same thing.

furthermore If I can somehow parse the plain text, can I then somehow change the font size or type to display in a rainmeter skin, so at the very least, headings, sub headings, and code elements are displayed differently?

and finally, are there any other bleeding flaws in this before I dive head first?
And before someone tells me to RTFM, try to understand that I WANT to, but only if its from a cool desktop gadget.
User avatar
balala
Rainmeter Sage
Posts: 10034
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Creating a skin that displays text from a reference manual

Post by balala »

CieroCeramics wrote:
March 20th, 2020, 1:36 am
First of all the skin I want to create will allow for a (probably very specific) search in a specified documentation repository,
docs.microsoft, docs.rainmeter, etc... and then display the associated text from that search in a Rainmeter text display skin.
for example if I search "webparser" in a skin titled "Rainmeter Documentation"

it should return the plain text from the website,
https://docs.rainmeter.net/manual/measures/webparser/
and display it in a window that allows scrolling.
Even if not exactly what you asked for, here is a first approach, which later can be polished, if needed. But for first please try out the following code to see if it at least partially, matches your needs:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
Solidcolor=0,0,0,80

[Variables]
Item=(?(?=.*<a href).*="(.*)" onmousedown="return rwt\(.*\)"><br><h3 class=".*">(.*)</h3>)
ToSearch=webparser

[StringStyle]
X=0
Y=0R
Padding=15,0,15,0
FontColor=220,220,220
FontEffectColor=0,0,0
SolidColor=0,0,0,1
StringEffect=Shadow
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=%1
MouseOverAction=[!SetOption #CURRENTSECTION# InlineSetting "Underline"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# InlineSetting "None"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]

[MeasureIPinfo]
Measure=WebParser
UpdateRate=3600
Url=https://www.google.com/search?sitesearch=docs.rainmeter.net&q=#ToSearch#
UserAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0
RegExp=(?siU)#Item##Item##Item##Item##Item#
DynamicVariables=1

[MeasureAddress1]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=1

[MeasureTitle1]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=2
DecodeCharacterReference=1

[MeasureAddress2]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=3

[MeasureTitle2]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=4
DecodeCharacterReference=1

[MeasureAddress3]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=5

[MeasureTitle3]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=6
DecodeCharacterReference=1

[MeasureAddress4]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=7

[MeasureTitle4]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=8
DecodeCharacterReference=1

[MeasureAddress5]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=9

[MeasureTitle5]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=10
DecodeCharacterReference=1

[MeterSearch]
Meter=STRING
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
FontEffectColor=0,0,0
SolidColor=0,0,0,1
StringEffect=Shadow
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Search results for "#ToSearch#":

[MeterTitle1]
Meter=STRING
MeterStyle=StringStyle
MeasureName=MeasureTitle1
LeftMouseUpAction=["[MeasureAddress1]"]

[MeterTitle2]
Meter=STRING
MeterStyle=StringStyle
MeasureName=MeasureTitle2
LeftMouseUpAction=["[MeasureAddress2]"]

[MeterTitle3]
Meter=STRING
MeterStyle=StringStyle
MeasureName=MeasureTitle3
LeftMouseUpAction=["[MeasureAddress3]"]

[MeterTitle4]
Meter=STRING
MeterStyle=StringStyle
MeasureName=MeasureTitle4
LeftMouseUpAction=["[MeasureAddress4]"]

[MeterTitle5]
Meter=STRING
MeterStyle=StringStyle
MeasureName=MeasureTitle5
LeftMouseUpAction=["[MeasureAddress5]"]
The skin does the followings: for now what it search for has to be added as the ToSearch variable into the [Variables] section, but obviously later a field where you can enter the term(s) you want to look for, can be added (if the code is alright, this will be a next step). The skin searches on Rainmeter documentation. It gets the first five (also can be increased if needed) results and shows them (no scroll so far). Each result is clickable, opening the appropriate article in your browser.
Please let me know if this matches (at least partially) what you want.
User avatar
CieroCeramics
Posts: 4
Joined: March 19th, 2020, 11:08 pm

Re: Creating a skin that displays text from a reference manual

Post by CieroCeramics »

holy moly, I was expecting a push in the right direction, but this is really amazing, thank you so so much for this. I will see what I can accomplish with this piece of code you provided and be sure your hard work does not go to waste!

i find it interesting that you used a google search to list the results. I never would have thought of that, never mind about having to use a specific keyword search thanks to you.

now I wonder if theres a way to use regex to read a whole html page that one of the search results links to. that will be my next step.
User avatar
balala
Rainmeter Sage
Posts: 10034
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Creating a skin that displays text from a reference manual

Post by balala »

CieroCeramics wrote:
March 20th, 2020, 9:40 pm
holy moly, I was expecting a push in the right direction, but this is really amazing, thank you so so much for this. I will see what I can accomplish with this piece of code you provided and be sure your hard work does not go to waste!
Very good. I'm glad if you find my code useful.
CieroCeramics wrote:
March 20th, 2020, 9:40 pm
i find it interesting that you used a google search to list the results. I never would have thought of that, never mind about having to use a specific keyword search thanks to you.
As I said, a next step would be to use an input field with an InputText plugin measure, to can dynamically enter the string you want to look for. Not impossible, I suppose. Will try it out tomorrow (here is almost midnight, so I'm not working anymore).
CieroCeramics wrote:
March 20th, 2020, 9:40 pm
now I wonder if theres a way to use regex to read a whole html page that one of the search results links to. that will be my next step.
Why? I doubt this would be a good idea. What can you do with the whole content of a page?
User avatar
Yincognito
Posts: 1077
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Creating a skin that displays text from a reference manual

Post by Yincognito »

balala wrote:
March 20th, 2020, 5:27 pm
Even if not exactly what you asked for, here is a first approach, which later can be polished, if needed. But for first please try out the following code to see if it at least partially, matches your needs:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
Solidcolor=0,0,0,80

[Variables]
Item=(?(?=.*<a href).*="(.*)" onmousedown="return rwt\(.*\)"><br><h3 class=".*">(.*)</h3>)
ToSearch=webparser

[StringStyle]
X=0
Y=0R
Padding=15,0,15,0
FontColor=220,220,220
FontEffectColor=0,0,0
SolidColor=0,0,0,1
StringEffect=Shadow
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=%1
MouseOverAction=[!SetOption #CURRENTSECTION# InlineSetting "Underline"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# InlineSetting "None"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]

[MeasureIPinfo]
Measure=WebParser
UpdateRate=3600
Url=https://www.google.com/search?sitesearch=docs.rainmeter.net&q=#ToSearch#
UserAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0
RegExp=(?siU)#Item##Item##Item##Item##Item#
DynamicVariables=1

[MeasureAddress1]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=1

[MeasureTitle1]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=2
DecodeCharacterReference=1

[MeasureAddress2]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=3

[MeasureTitle2]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=4
DecodeCharacterReference=1

[MeasureAddress3]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=5

[MeasureTitle3]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=6
DecodeCharacterReference=1

[MeasureAddress4]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=7

[MeasureTitle4]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=8
DecodeCharacterReference=1

[MeasureAddress5]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=9

[MeasureTitle5]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=10
DecodeCharacterReference=1

[MeterSearch]
Meter=STRING
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
FontEffectColor=0,0,0
SolidColor=0,0,0,1
StringEffect=Shadow
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Search results for "#ToSearch#":

[MeterTitle1]
Meter=STRING
MeterStyle=StringStyle
MeasureName=MeasureTitle1
LeftMouseUpAction=["[MeasureAddress1]"]

[MeterTitle2]
Meter=STRING
MeterStyle=StringStyle
MeasureName=MeasureTitle2
LeftMouseUpAction=["[MeasureAddress2]"]

[MeterTitle3]
Meter=STRING
MeterStyle=StringStyle
MeasureName=MeasureTitle3
LeftMouseUpAction=["[MeasureAddress3]"]

[MeterTitle4]
Meter=STRING
MeterStyle=StringStyle
MeasureName=MeasureTitle4
LeftMouseUpAction=["[MeasureAddress4]"]

[MeterTitle5]
Meter=STRING
MeterStyle=StringStyle
MeasureName=MeasureTitle5
LeftMouseUpAction=["[MeasureAddress5]"]
The skin does the followings: for now what it search for has to be added as the ToSearch variable into the [Variables] section, but obviously later a field where you can enter the term(s) you want to look for, can be added (if the code is alright, this will be a next step). The skin searches on Rainmeter documentation. It gets the first five (also can be increased if needed) results and shows them (no scroll so far). Each result is clickable, opening the appropriate article in your browser.
Please let me know if this matches (at least partially) what you want.
Nice approach through Google, but why doesn't it work with a different UserAgent (e.g. Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36)? The one you set works fine, just not others...maybe you have an idea why?

That being said, the following get the results' URL, Title and Content (so it captures all 3 elements of a search result):

Code: Select all

Item=.*<div class="g".*>.*<div class="rc".*>.*<div class="r".*>.*<a href="(.*)".*>.*<h3 class=".*">(.*)</h3>.*<div class="s".*>.*<span class="st".*>(.*)</span>

Code: Select all

RegExp=(?siU).*<div id="search".*>.*<div class="srg".*>#Item##Item##Item##Item##Item#.*
I've encountered some regex errors when using your Item variable and RegExp, by the way (the URLs wouldn't capture well) - that's why I posted the above.
User avatar
Yincognito
Posts: 1077
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Creating a skin that displays text from a reference manual

Post by Yincognito »

CieroCeramics wrote:
March 20th, 2020, 1:36 am
First of all the skin I want to create will allow for a (probably very specific) search in a specified documentation repository,
docs.microsoft, docs.rainmeter, etc... and then display the associated text from that search in a Rainmeter text display skin.
for example if I search "webparser" in a skin titled "Rainmeter Documentation"

it should return the plain text from the website,
https://docs.rainmeter.net/manual/measures/webparser/
and display it in a window that allows scrolling.

I am unclear on weather regex is able to read through and html file and sort through the proper elements. word on the street is if you try to convert html pages using regex, you're going to have a bad time. I know there is some pretty cool technology that can make the text in to a more regex friendly format, but I don't know where to start with making rainmeter do the same thing.

furthermore If I can somehow parse the plain text, can I then somehow change the font size or type to display in a rainmeter skin, so at the very least, headings, sub headings, and code elements are displayed differently?

and finally, are there any other bleeding flaws in this before I dive head first?
And before someone tells me to RTFM, try to understand that I WANT to, but only if its from a cool desktop gadget.
CieroCeramics wrote:
March 20th, 2020, 9:40 pm
now I wonder if theres a way to use regex to read a whole html page that one of the search results links to. that will be my next step.
Ok now, first let me say that parsing entire HTML pages, while not (technically) impossible using regex, is going to be very tough - and I have some experience in that, LOL. The bare text might be "easier" to get (by, say, eliminating tags </tag>.*</tag> from the page source, along with expertly extracting the right strings from within quotes), but if you want to convert HTML headings and such into Rainmeter inline format ... well, let's say it's going to take a LOT of effort (to put it mildly).

My advice is to just open the desired page in a browser and be done with it. There's going to be way too much effort (and, to be honest with you, way too less experience in regex for you) to even attempt to do otherwise.

EDIT: You could however try a limited approach to this, taking advantage of Google's work, balala's sample and my "improved" regex above to get a short "summary"/ "extract" of the linked page in tooltips (you can, of course, make it more elegant than this, although I doubt you'd need scrollbars for it):

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
Solidcolor=0,0,0,80

[Variables]
Item=.*<div class="g".*>.*<div class="rc".*>.*<div class="r".*>.*<a href="(.*)".*>.*<h3 class=".*">(.*)</h3>.*<div class="s".*>.*<span class="st".*>(.*)</span>
ToSearch=webparser
TagCleaner="(?siU)<([^\s]+)(?: .+)?>":""
TooltipW=300

[StringStyle]
X=0
Y=0R
Padding=15,0,15,0
FontColor=220,220,220
FontEffectColor=0,0,0
SolidColor=0,0,0,1
StringEffect=Shadow
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=%1
MouseOverAction=[!SetOption #CURRENTSECTION# InlineSetting "Underline"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# InlineSetting "None"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]

[MeasureIPinfo]
Measure=WebParser
UpdateRate=3600
Url=https://www.google.com/search?sitesearch=docs.rainmeter.net&q=#ToSearch#
UserAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0
RegExp=(?siU).*<div id="search".*>.*<div class="srg".*>#Item##Item##Item##Item##Item#.*
DynamicVariables=1

[MeasureAddress1]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=1

[MeasureTitle1]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=2
DecodeCharacterReference=1

[MeasureExtract1]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=3
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute="#TagCleaner#"
DynamicVariables=1

[MeasureAddress2]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=4

[MeasureTitle2]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=5
DecodeCharacterReference=1

[MeasureExtract2]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=6
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute="#TagCleaner#"

[MeasureAddress3]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=7

[MeasureTitle3]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=8
DecodeCharacterReference=1

[MeasureExtract3]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=9
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute="#TagCleaner#"

[MeasureAddress4]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=10

[MeasureTitle4]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=11
DecodeCharacterReference=1

[MeasureExtract4]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=12
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute="#TagCleaner#"

[MeasureAddress5]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=13

[MeasureTitle5]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=14
DecodeCharacterReference=1

[MeasureExtract5]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=15
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute="#TagCleaner#"

[MeterSearch]
Meter=STRING
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
FontEffectColor=0,0,0
SolidColor=0,0,0,1
StringEffect=Shadow
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Search results for "#ToSearch#":

[MeterTitle1]
Meter=STRING
MeterStyle=StringStyle
MeasureName=MeasureTitle1
LeftMouseUpAction=["[MeasureAddress1]"]
TooltipText="[MeasureExtract1]"
TooltipWidth=#TooltipW#
DynamicVariables=1

[MeterTitle2]
Meter=STRING
MeterStyle=StringStyle
MeasureName=MeasureTitle2
LeftMouseUpAction=["[MeasureAddress2]"]
TooltipText="[MeasureExtract2]"
TooltipWidth=#TooltipW#
DynamicVariables=1

[MeterTitle3]
Meter=STRING
MeterStyle=StringStyle
MeasureName=MeasureTitle3
LeftMouseUpAction=["[MeasureAddress3]"]
TooltipText="[MeasureExtract3]"
TooltipWidth=#TooltipW#
DynamicVariables=1

[MeterTitle4]
Meter=STRING
MeterStyle=StringStyle
MeasureName=MeasureTitle4
LeftMouseUpAction=["[MeasureAddress4]"]
TooltipText="[MeasureExtract4]"
TooltipWidth=#TooltipW#
DynamicVariables=1

[MeterTitle5]
Meter=STRING
MeterStyle=StringStyle
MeasureName=MeasureTitle5
LeftMouseUpAction=["[MeasureAddress5]"]
TooltipText="[MeasureExtract5]"
TooltipWidth=#TooltipW#
DynamicVariables=1
User avatar
balala
Rainmeter Sage
Posts: 10034
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Creating a skin that displays text from a reference manual

Post by balala »

Yincognito wrote:
March 20th, 2020, 10:03 pm
Nice approach through Google, but why doesn't it work with a different UserAgent (e.g. Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36)? The one you set works fine, just not others...maybe you have an idea why?
No, I have not.
Yincognito wrote:
March 20th, 2020, 10:03 pm
That being said, the following get the results' URL, Title and Content (so it captures all 3 elements of a search result):

Code: Select all

Item=.*<div class="g".*>.*<div class="rc".*>.*<div class="r".*>.*<a href="(.*)".*>.*<h3 class=".*">(.*)</h3>.*<div class="s".*>.*<span class="st".*>(.*)</span>
Yes, good approach. As I said my RegExp (or the entire code) has to be improved. This is the first step.
Yincognito wrote:
March 20th, 2020, 10:03 pm

Code: Select all

RegExp=(?siU).*<div id="search".*>.*<div class="srg".*>#Item##Item##Item##Item##Item#.*
I've encountered some regex errors when using your Item variable and RegExp, by the way (the URLs wouldn't capture well) - that's why I posted the above.
I don't get any error, checked before posted my code. What kind of error do you get?
User avatar
Yincognito
Posts: 1077
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Creating a skin that displays text from a reference manual

Post by Yincognito »

balala wrote:
March 21st, 2020, 7:19 am
I don't get any error, checked before posted my code. What kind of error do you get?
As far as I recall (since I modified the code already into what I posted above), there were Errors -1 and -8 (don't know their text, unfortunately). Basically, what happened is that when checking the Log, the captured addresses included around 5-6 characters from before their location in the page source, an obviously the links would not work when left clicking on them to open in the browser. The titles worked fine though, just not the addresses.

So, after looking at it, I changed the regex a bit and took all of these from their (I believe) correct location in the page source. They are just minor modifications to your code anyway, so that it works even better.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 3852
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Creating a skin that displays text from a reference manual

Post by eclectic-tech »

Yincognito wrote:
March 21st, 2020, 12:37 pm
As far as I recall (since I modified the code already into what I posted above), there were Errors -1 and -8 (don't know their text, unfortunately). Basically, what happened is that when checking the Log, the captured addresses included around 5-6 characters from before their location in the page source, an obviously the links would not work when left clicking on them to open in the browser. The titles worked fine though, just not the addresses.

So, after looking at it, I changed the regex a bit and took all of these from their (I believe) correct location in the page source. They are just minor modifications to your code anyway, so that it works even better.
I too had the same results with the first code... the one supplied by Yincognito works, in fact it works on other sites too!

Thanks to balala's and Yincognito's code, I was able to expand the skin to accept a search input, and have a context menu list of site to select: Google Docs, Microsoft Docs, Oracle Docs, and Rainmeter Docs!

This is like getting a birthday present from all of you! CieroCeramics for the idea, and balala/Yincognito for the initial code!
Thanks! :great:

DocSearch.ini

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

RightMouseUpAction=[!SkinCustomMenu]

ContextTitle=Google Docs
ContextAction=[!WriteKeyValue "Variables" "Site" "Google.com"][!Refresh]
ContextTitle2=Microsoft Docs
ContextAction2=[!WriteKeyValue "Variables" "Site" "Microsoft.com"][!Refresh]
ContextTitle3=Oracle Docs
ContextAction3=[!WriteKeyValue "Variables" "Site" "Oracle.com"][!Refresh]
ContextTitle4=Rainmeter Docs
ContextAction4=[!WriteKeyValue "Variables" "Site" "Rainmeter.net"][!Refresh]
ContextTitle5=---
ContextTitle6=More actions...
ContextAction6=[!SkinMenu]

[Variables]
Site=Google.com
Item=.*<div class="g".*>.*<div class="rc".*>.*<div class="r".*>.*<a href="(.*)".*>.*<h3 class=".*">(.*)</h3>.*<div class="s".*>.*<span class="st".*>(.*)</span>
ToSearch=style
TagCleaner="(?siU)<([^\s]+)(?: .+)?>":""
TooltipW=300

[StringStyle]
X=0
Y=0R
W=300
ClipString=1
Padding=15,2,15,2
FontColor=255,255,255
FontEffectColor=0,0,0
SolidColor=0,0,0,1
StringEffect=Shadow
FontSize=10
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=%1
MouseOverAction=[!SetOption #CURRENTSECTION# InlineSetting "Underline"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# InlineSetting "None"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]

[MeasureSiteTitle]
Measure=String
String=#Site#
RegExpSubstitute=1
Substitute="^(.*)\..*$":"\1"

[MeasureInputText]
Measure=Plugin
Plugin=InputText
InputLimit=0
InputNumber=0
X=15
Y=6
W=300
H=16
Command1=[!WriteKeyValue Variables ToSearch "$UserInput$"]
Command2=[!Refresh "#CURRENTCONFIG#"]
DefaultValue=#ToSearch#
; Password=
; SolidColor=
FontColor=0,0,0
FontFace=SegoeUI
FontSize=10
; StringStyle=
; StringAlign=
FocusDismiss=1

[MeasureIPinfo]
Measure=WebParser
UpdateRate=3600
Url=https://www.google.com/search?sitesearch=docs.#Site#&q=#ToSearch#
UserAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0
RegExp=(?siU).*<div id="search".*>.*<div class="srg".*>#Item##Item##Item##Item##Item#.*
DynamicVariables=1

[MeasureAddress1]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=1

[MeasureTitle1]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=2
DecodeCharacterReference=1

[MeasureExtract1]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=3
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute="#TagCleaner#"
DynamicVariables=1

[MeasureAddress2]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=4

[MeasureTitle2]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=5
DecodeCharacterReference=1

[MeasureExtract2]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=6
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute="#TagCleaner#"

[MeasureAddress3]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=7

[MeasureTitle3]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=8
DecodeCharacterReference=1

[MeasureExtract3]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=9
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute="#TagCleaner#"

[MeasureAddress4]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=10

[MeasureTitle4]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=11
DecodeCharacterReference=1

[MeasureExtract4]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=12
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute="#TagCleaner#"

[MeasureAddress5]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=13

[MeasureTitle5]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=14
DecodeCharacterReference=1

[MeasureExtract5]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=15
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute="#TagCleaner#"

[MeterBackgground]
Meter=Shape
X=0
Y=0
; Shape=Rectangle X,Y,W,H,{Rx},{Ry} | StrokeWidth 2 | Stroke Color 0,0,0,255 | Fill Color 255,255,255,255
Shape=Rectangle 0,0,330,145,3 | Fill Color 0,0,0,80 | StrokeWidth 1 | StrokeColor 0,0,0,220
; Documentation: https://docs.rainmeter.net/manual-beta/meters/shape/#Rectangle

[MeterSearch]
Meter=STRING
X=0
Y=0
W=300
Padding=15,5,15,5
FontColor=255,255,255
FontEffectColor=0,0,0
SolidColor=0,0,0,100
StringEffect=Shadow
FontSize=10
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=[&MeasureSiteTitle] Doc Search for "#ToSearch#":
LeftMouseUpAction=!CommandMeasure "MeasureInputText" "ExecuteBatch 1-2"

[MeterTitle1]
Meter=STRING
MeterStyle=StringStyle
MeasureName=MeasureTitle1
LeftMouseUpAction=["[MeasureAddress1]"]
TooltipText="[MeasureExtract1]"
TooltipWidth=#TooltipW#
DynamicVariables=1

[MeterTitle2]
Meter=STRING
MeterStyle=StringStyle
MeasureName=MeasureTitle2
LeftMouseUpAction=["[MeasureAddress2]"]
TooltipText="[MeasureExtract2]"
TooltipWidth=#TooltipW#
DynamicVariables=1

[MeterTitle3]
Meter=STRING
MeterStyle=StringStyle
MeasureName=MeasureTitle3
LeftMouseUpAction=["[MeasureAddress3]"]
TooltipText="[MeasureExtract3]"
TooltipWidth=#TooltipW#
DynamicVariables=1

[MeterTitle4]
Meter=STRING
MeterStyle=StringStyle
MeasureName=MeasureTitle4
LeftMouseUpAction=["[MeasureAddress4]"]
TooltipText="[MeasureExtract4]"
TooltipWidth=#TooltipW#
DynamicVariables=1

[MeterTitle5]
Meter=STRING
MeterStyle=StringStyle
MeasureName=MeasureTitle5
LeftMouseUpAction=["[MeasureAddress5]"]
TooltipText="[MeasureExtract5]"
TooltipWidth=#TooltipW#
DynamicVariables=1
Padding=15,2,15,5
My Personal Version
docsearch.png
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 10034
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Creating a skin that displays text from a reference manual

Post by balala »

Yincognito wrote:
March 21st, 2020, 12:37 pm
an obviously the links would not work when left clicking on them to open in the browser. The titles worked fine though, just not the addresses.
Yes, indeed, didn't notice this at the time I posted my code. Probably I didn't check it enough, however this seems a little bit weird, because I'm used to check every code I post, before posting it. But who knows what happened then? :confused: