Page 1 of 1

Help write RegExp correctly

Posted: January 31st, 2021, 6:51 am
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

Re: Help write RegExp correctly

Posted: January 31st, 2021, 7:22 am
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

Re: Help write RegExp correctly

Posted: January 31st, 2021, 7:59 am
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

Re: Help write RegExp correctly

Posted: January 31st, 2021, 8:03 am
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

Re: Help write RegExp correctly

Posted: January 31st, 2021, 8:25 am
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!

Re: Help write RegExp correctly

Posted: January 31st, 2021, 8:28 am
by xenium
umanets_alexander wrote: January 31st, 2021, 8:25 am tried restarting rainmeter, really works, thanks a lot!
You're welcome

Re: Help write RegExp correctly

Posted: January 31st, 2021, 8:56 am
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

Re: Help write RegExp correctly

Posted: January 31st, 2021, 9:28 am
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