It is currently March 28th, 2024, 10:13 am

Help write RegExp correctly

General topics related to Rainmeter.
Post Reply
umanets_alexander
Posts: 6
Joined: January 28th, 2021, 5:13 am

Help write RegExp correctly

Post by umanets_alexander »

Hello everyone, I need help on how to write the correct RegExp for the image site.
For example, I took and redid a simple version:

Code: Select all

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

[MeasureImageLocation]
Measure=WebParser
UpdateRate=1800
Url=https://www.calend.ru/holidays/russtate/
RegExp=(?siU)<div class="informer" style="text-align: center"> <a href="/holidays/russtate/"><img src="(.*)"></a>
StringIndex=1
FinishAction=[!CommandMeasure MeasureImageDownload "Update"] 

[MeasureImageDownload]
Measure=WebParser
UpdateRate=1800
Url=https://www.calend.ru/holidays/russtate/[&MeasureImageLocation]
StringIndex=1
DynamicVariables=1
Download=1

[MeterDisplayImage]
Meter=IMAGE
MeasureName=MeasureImageDownload
W=200
PreserveAspectRatio=1
For some reason it doesn't work like that.
I need to take a picture on the site, it is highlighted in the picture below:
Image
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: Help write RegExp correctly

Post by xenium »

umanets_alexander wrote: January 31st, 2021, 6:51 am Hello everyone, I need help on how to write the correct RegExp for the image site.
For example, I took and redid a simple version:

Code: Select all

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

[MeasureImageLocation]
Measure=WebParser
UpdateRate=1800
Url=https://www.calend.ru/holidays/russtate/
RegExp=(?siU)<div class="informer" style="text-align: center"> <a href="/holidays/russtate/"><img src="(.*)"></a>
StringIndex=1
FinishAction=[!CommandMeasure MeasureImageDownload "Update"] 

[MeasureImageDownload]
Measure=WebParser
UpdateRate=1800
Url=https://www.calend.ru/holidays/russtate/[&MeasureImageLocation]
StringIndex=1
DynamicVariables=1
Download=1

[MeterDisplayImage]
Meter=IMAGE
MeasureName=MeasureImageDownload
W=200
PreserveAspectRatio=1
For some reason it doesn't work like that.
I need to take a picture on the site, it is highlighted in the picture below:
Image
Try this:

Code: Select all

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

[MeasureImage]
Measure=WebParser
UpdateRate=1800
Url=https://www.calend.ru/holidays/russtate/
RegExp=(?siU)<div class="informer" style="text-align: center"> <a href="/holidays/russtate/"><img src="(.*)".*>
StringIndex=1
DynamicVariables=1
Download=1
DownloadFile=.\\Image.png
FinishAction=[!UpdateMeter MeterDisplayImage][!Redraw]

[MeterDisplayImage]
Meter=IMAGE
MeasureName=MeasureImage
W=200
UpdateDivider=-1
PreserveAspectRatio=1
umanets_alexander
Posts: 6
Joined: January 28th, 2021, 5:13 am

Re: Help write RegExp correctly

Post by umanets_alexander »

xenium wrote: January 31st, 2021, 7:22 am Try this:

Code: Select all

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

[MeasureImage]
Measure=WebParser
UpdateRate=1800
Url=https://www.calend.ru/holidays/russtate/
RegExp=(?siU)<div class="informer" style="text-align: center"> <a href="/holidays/russtate/"><img src="(.*)".*>
StringIndex=1
DynamicVariables=1
Download=1
DownloadFile=.\\Image.png
FinishAction=[!UpdateMeter MeterDisplayImage][!Redraw]

[MeterDisplayImage]
Meter=IMAGE
MeasureName=MeasureImage
W=200
UpdateDivider=-1
PreserveAspectRatio=1
This option also did not work for some reason
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: Help write RegExp correctly

Post by xenium »

umanets_alexander wrote: January 31st, 2021, 7:59 am This option also did not work for some reason
It works for me
Capture.PNG
umanets_alexander
Posts: 6
Joined: January 28th, 2021, 5:13 am

Re: Help write RegExp correctly

Post by umanets_alexander »

xenium wrote: January 31st, 2021, 8:03 am It works for me
Capture.PNG

tried restarting rainmeter, really works, thanks a lot!
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: Help write RegExp correctly

Post by xenium »

umanets_alexander wrote: January 31st, 2021, 8:25 am tried restarting rainmeter, really works, thanks a lot!
You're welcome
umanets_alexander
Posts: 6
Joined: January 28th, 2021, 5:13 am

Re: Help write RegExp correctly

Post by umanets_alexander »

xenium wrote: January 31st, 2021, 8:28 am You're welcome

Is it possible to specify the path to the image without url? For example, there is a link, but it is not on any page

Code: Select all

https://www.calend.ru/img/export/informer_1.png
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: Help write RegExp correctly

Post by xenium »

umanets_alexander wrote: January 31st, 2021, 8:56 am Is it possible to specify the path to the image without url? For example, there is a link, but it is not on any page

Code: Select all

https://www.calend.ru/img/export/informer_1.png
Try this:

Code: Select all

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


[MeasureImage]
Measure=WebParser
UpdateRate=1800
Url=https://www.calend.ru/img/export/informer_1.png
Download=1
DownloadFile=.\\Image.png
FinishAction=[!UpdateMeter MeterDisplayImage][!Redraw]

[MeterDisplayImage]
Meter=IMAGE
MeasureName=MeasureImage
W=200
UpdateDivider=-1
PreserveAspectRatio=1
Post Reply