It is currently March 29th, 2024, 5:49 am

Skripting BUG . RegExpTester vs Real

Get help with creating, editing & fixing problems with skins
VolkerGr
Posts: 4
Joined: November 8th, 2020, 5:18 pm

Skripting BUG . RegExpTester vs Real

Post by VolkerGr »

And help is welcome.
Reg Expression works in RegExpTester. But not in "Real" Skript as follow
Thanx

Code: Select all

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

[MeasureSite]
Measure=WebParser
URL=https://www.lgl.bayern.de/gesundheit/infektionsschutz/infektionskrankheiten_a_z/coronavirus/karte_coronavirus/
RegExp=(?siU)<tr>.*<td>Würzburg</td>.*<td>(.*)</td>.*<td>(.*)</td>.*<td>(.*)</td>.*<td>(.*)</td>.*<td>(.*)</td>.*<td>(.*)</td>.*<td>(.*)</td>


[MeterDummy]
Meter=String

[MeasureValue]
Measure=WebParser
URL=[MeasureSite]
StringIndex=1
Last edited by balala on November 8th, 2020, 5:39 pm, edited 1 time in total.
Reason: Please use [code] tags whenever are you posting code snippets. It's the </> button.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Skripting BUG . RegExpTester vs Real

Post by eclectic-tech »

The RegExp "works" but it takes 5 seconds to show the results due to the skin update set to 5000ms.
The RegExp captures "spaces", "line feeds", and "carriage returns" ... this can be eliminated for the "Würzburg" results by using:
RegExp=(?siU)<tr>.*<td>Würzburg</td>.*<td>.*\r\n\s++(.*)</td>.*<td>.*\r\n\s++(.*)</td>.*<td>(.*)</td>.*<td>(.*)</td>.*<td>(.*)</td>.*<td>.*\r\n\s++(.*)</td>.*<td>.*\r\n\s++(.*)</td>

Code: Select all

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

[MeasureSite]
Measure=WebParser
URL=https://www.lgl.bayern.de/gesundheit/infektionsschutz/infektionskrankheiten_a_z/coronavirus/karte_coronavirus/
RegExp=(?siU)(?siU)<tr>.*<td>Würzburg</td>.*<td>.*\r\n\s++(.*)</td>.*<td>.*\r\n\s++(.*)</td>.*<td>(.*)</td>.*<td>(.*)</td>.*<td>(.*)</td>.*<td>.*\r\n\s++(.*)</td>.*<td>.*\r\n\s++(.*)</td>

[MeasureValue1]
Measure=WebParser
URL=[MeasureSite]
StringIndex=1

[MeasureValue2]
Measure=WebParser
URL=[MeasureSite]
StringIndex=2

[MeasureValue3]
Measure=WebParser
URL=[MeasureSite]
StringIndex=3

[MeasureValue4]
Measure=WebParser
URL=[MeasureSite]
StringIndex=4

[MeasureValue5]
Measure=WebParser
URL=[MeasureSite]
StringIndex=5

[MeasureValue6]
Measure=WebParser
URL=[MeasureSite]
StringIndex=6

[MeasureValue7]
Measure=WebParser
URL=[MeasureSite]
StringIndex=7

[MeterValue1]
Meter=String
MeasureName=MeasureValue1
FontSize=24
FontColor=255,255,255

[MeterValue2]
Meter=String
MeasureName=MeasureValue2
X=r
Y=R
FontSize=24
FontColor=255,255,255

[MeterValue3]
Meter=String
MeasureName=MeasureValue3
X=r
Y=R
FontSize=24
FontColor=255,255,255

[MeterValue4]
Meter=String
MeasureName=MeasureValue4
X=r
Y=R
FontSize=24
FontColor=255,255,255

[MeterValue5]
Meter=String
MeasureName=MeasureValue5
X=r
Y=R
FontSize=24
FontColor=255,255,255

[MeterValue6]
Meter=String
MeasureName=MeasureValue6
X=r
Y=R
FontSize=24
FontColor=255,255,255

[MeterValue7]
Meter=String
MeasureName=MeasureValue7
X=r
Y=R
FontSize=24
FontColor=255,255,255

wurtzberg.png
You do not have the required permissions to view the files attached to this post.
VolkerGr
Posts: 4
Joined: November 8th, 2020, 5:18 pm

Re: Skripting BUG . RegExpTester vs Real

Post by VolkerGr »

Thanks alot,
Still getting used to the syntax of RegExpression. I can read them perfect,but creating my own twists my head :)
Even i am a computer sience engineer ;) But i appreciate your help
Regards ;)
VolkerGr
Posts: 4
Joined: November 8th, 2020, 5:18 pm

Re: Skripting BUG . RegExpTester vs Real

Post by VolkerGr »

Interresting,
I still runs into a
RegExp matching error (-1) (Test\Test.ini - [MeasureSite])
I exactly parsed your script.
In RegExTester still works. This is weired
You do not have the required permissions to view the files attached to this post.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Skripting BUG . RegExpTester vs Real

Post by eclectic-tech »

VolkerGr wrote: November 9th, 2020, 12:17 pm Interresting,
I still runs into a
RegExp matching error (-1) (Test\Test.ini - [MeasureSite])
I exactly parsed your script.
In RegExTester still works. This is weired
You have this file encoded as UTF-8 which will not work properly; change the encoding to USC-2 LE BOM.
(See: This Tip)
JSMorley wrote:I strongly suggest that ALL Rainmeter skin .ini files be encoded as UTF-16 LIttle Endian. This will allow you to use any of the characters from the ASCII / Extended ASCII set, as well as any Unicode characters. Unicode of course has the additional imitation that the font you are using in the skin must support the character(s), but most decent fonts support a wide range of Unicode characters. This is one of those situations where doing it this way can never hurt, but not doing it can lead to confusion and problems. Just get in the habit. Note that the new "Create new skin" functionality in Rainmeter's Manage dialog will always create new .ini files as UTF-16 Little Endian.

The encoding you want in different text editors:

Unicode (Windows Notepad.exe)
UCS-2 LE BOM (Notepad++)
UTF-16 LE (Sublime Text)
Because you have the skin Update=10000 after 10 seconds you will see the results of the refreshed skin.
VolkerGr
Posts: 4
Joined: November 8th, 2020, 5:18 pm

Re: Skripting BUG . RegExpTester vs Real

Post by VolkerGr »

Yeap,
i had the same idea during coffee time.
The german "Umlaut" W"ü"rz is crashing the parser
Thanks again for your help
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Skripting BUG . RegExpTester vs Real

Post by eclectic-tech »

Happy to help :thumbup:
gtjgtj
Posts: 17
Joined: December 29th, 2018, 3:53 pm

Re: Skripting BUG . RegExpTester vs Real

Post by gtjgtj »

I have a similar problem.
It is also about corona values.
I also have difficulties to read the values with the webparser.

The problem is probably due to a hyphen "-" on the one hand and an umlaut on the other hand.

You write to encode all skins on ALL INI files of the Rainmeter skin as UTF-16 LIttle Endian.
How and where to do that?

Here my example.

In the HTML code I want to read, it says Nieder-sachsen (Lower Saxony).
This does not work.
If I enter Hamburg it works.
If I enter Wolfenbüttel with "ü", it does not work either.

I think the problems are the false UTF-code?

What can I do to make it work?

Thank you for helping :-)

Code: Select all

[MeasureNiedersachsen]
Measure=WebParser
Url=https://www.rki.de/DE/Content/InfAZ/N/Neuartiges_Coronavirus/Fallzahlen.html
RegExp=(?siU).*>Nieder-Sachsen</td><td class="right" colspan="1" rowspan="1">(.*)</td>


StringIndex=1 
    
------

[MeterNiedersachsen]
Meter=String 
MeasureName=MeasureNiedersachsen
MeterStyle=StyleDatenstand
X=250
Y=136
AntiAlias=1

Text=Gesamt: %1
User avatar
SilverAzide
Rainmeter Sage
Posts: 2588
Joined: March 23rd, 2015, 5:26 pm

Re: Skripting BUG . RegExpTester vs Real

Post by SilverAzide »

gtjgtj wrote: March 11th, 2021, 6:18 pm You write to encode all skins on ALL INI files of the Rainmeter skin as UTF-16 LIttle Endian.
How and where to do that?
If you are using Notepad, then in the Save As dialog, select the Encoding option:
Notepad.png

If you are using Notepad++, select the encoding, or convert an existing file, like so:
Screenshot 2021-03-11 133807.png
You do not have the required permissions to view the files attached to this post.
Gadgets Wiki GitHub More Gadgets...
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Skripting BUG . RegExpTester vs Real

Post by balala »

EDIT: SilverAzide beat me on the encoding problem.
gtjgtj wrote: March 11th, 2021, 6:18 pm You write to encode all skins on ALL INI files of the Rainmeter skin as UTF-16 LIttle Endian.
How and where to do that?
Depends on what editor are you using. If you're using Notepad, click File > Save as and in the Save as window choose UTF-16 LE in the Encoding drop down menu. If you're using Notepad++, click Encoding > UCS-2 LE BOM.
Don't know how this has to be done in other text editors (like Sublime Text, for instance).
gtjgtj wrote: March 11th, 2021, 6:18 pm In the HTML code I want to read, it says Nieder-sachsen (Lower Saxony).
This does not work.
If I enter Hamburg it works.
Might be the wrong encoding as well, however there is one more mistake. Replace the RegExp option of the [MeasureNiedersachsen] measure with the following one: RegExp=(?siU).*>Nieder[\xAD]Sachsen</td><td class="right" colspan="1" rowspan="1">(.*)</td>. The culprit was the - sign, used in Nieder-Sachsen. There you have to use not a simple -, but a character with the ­[\xAD] code, as you see above.
gtjgtj wrote: March 11th, 2021, 6:18 pm If I enter Wolfenbüttel with "ü", it does not work either.
There is no such name as Wolfenbüttel in the whole code. I tried to look for Wolfenb, to make sure the ü is not causing a problem, but didn't find neither Wolfenb. So I think there are no data for such a location, that's why it doesn't work. If you're looking for Wolfenbüttel on the site, there is no match either, so such a location doesn't exist, at least not on this site.