It is currently April 27th, 2024, 3:53 pm

WebParser: Local Files and inserting the parsing result into the URL.

Get help with creating, editing & fixing problems with skins
Kotofanchik
Posts: 95
Joined: March 15th, 2024, 7:30 pm

WebParser: Local Files and inserting the parsing result into the URL.

Post by Kotofanchik »

I've been racking my brains for a couple of hours. Local files are not parsed. I've already made a separate test skin and it doesn't work, what's the reason?

Code: Select all

[Rainmeter]
Update		=1000

[Background]
Meter		=IMAGE
X=1
Y=1
W			=600
H			=310
SolidColor	=5,5,5,150

[mnowdata]
Measure=Plugin
Plugin=WebParser
Url=file://C:\Users\RmicroN\Desktop\nnn.txt
RegExp="(?siU)FontColor=(.*),.*"

[City]
Meter		=STRING
MeasureName	=mnowdata
X			=8
Y			=120
FontColor=255,255,255
FontEffectColor=0,0,0,150
StringEffect=SHADOW
StringStyle=BOLD 
FontFace=CENTURY
StringAlign=Left
FontSize=12
At the same time, Rainregexp does everything as it should.
Last edited by Kotofanchik on March 27th, 2024, 11:32 am, edited 1 time in total.
User avatar
KazukiGames82
Posts: 8
Joined: January 25th, 2023, 2:56 am

Re: WebParser: Local Files

Post by KazukiGames82 »

Isn't better use @Include options instead of parsing an text file?
https://docs.rainmeter.net/manual/skins/include-option/#Include

also, in rainmeter logs you can see if your parser measure is returning something, looks good, but you should check the path and if exists the file.
Rainmeter_ioPXAHvJQ4.png
You do not have the required permissions to view the files attached to this post.
Kotofanchik
Posts: 95
Joined: March 15th, 2024, 7:30 pm

Re: WebParser: Local Files

Post by Kotofanchik »

unexpectedly everything worked. I just clicked update the skin again and it found what I was looking for. I haven't found it before. There were no errors in the log. but there was no string value as a result of measure either. scratching my turnips

Then another question. Actually because of him I started analyzing the file.
In the file I have a value, a code that needs to be added to the URL as part of the address. For example, instead of xxxx in the address https://docs.xxxx.net
insert a value, for example cod123, to get https://docs.cod123.net. I write this value to the file myself. and no matter what I did, it was not transmitted, although the rest of the skin saw it. So I decided to try to parse it directly from the file and it didn’t work either.
Kotofanchik
Posts: 95
Joined: March 15th, 2024, 7:30 pm

Re: WebParser: Local Files

Post by Kotofanchik »

I figured out why it’s not looking in the file. He doesn't like the coding. If UTF-8, then it searches normally. and with UTF-16 encoding, LE BOM, which is found in Rainmeter files, does not find anything. At the same time, Rainregexp searches both ways.
But the question of how to insert the required numbers and letters into the URL is still relevant.
User avatar
balala
Rainmeter Sage
Posts: 16177
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: WebParser: Local Files

Post by balala »

To get help, you should have to pack the config you're working with and post the package here. Make sure to include into the package, the file you have to parse with the WebParser measure (C:\Users\RmicroN\Desktop\nnn.txt). Without having those files, it's hard to help you.
Kotofanchik
Posts: 95
Joined: March 15th, 2024, 7:30 pm

Re: WebParser: Local Files

Post by Kotofanchik »

This problem has been resolved. It turned out that regexp cannot parse the file utf-16-le with bom. If you convert to utf-8, then regexp works, I note that rainregexp parses both utf-8 and utf-16-le with bom equally well.
but the main problem that caused me to parse the file has not been solved
Kotofanchik
Posts: 95
Joined: March 15th, 2024, 7:30 pm

Re: WebParser: Local Files

Post by Kotofanchik »

Now we need to measure the result of the work

Code: Select all

[mCod]
Measure=WebParser
Url=file://#CURRENTPATH#Settings.inc
RegExp="(?siU)weather-.*-(.*)/.*"
stringindex=1
Substitute regexp into the URL for it to work regexp

Code: Select all

[mTotal]
Measure		=Plugin
Plugin		=WebParser
UpdateRate	=3600
Url			=https://services.gfore.net/inform-service/#hash_val#/forecast/?lang=#lang#&city=#here the value from mcod must be inserted#
UserAgent	=#uagent#
RegExp		="(?siU)<location(.*)</location>"
Kotofanchik
Posts: 95
Joined: March 15th, 2024, 7:30 pm

Re: WebParser: Local Files

Post by Kotofanchik »

Or teach how to assign a value obtained from measure to a variable. I tried all the variants of quotation brackets at random. Not assigned. :)
RicardoTM
Posts: 268
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: WebParser: Local Files

Post by RicardoTM »

Kotofanchik wrote: March 27th, 2024, 3:19 am Or teach how to assign a value obtained from measure to a variable. I tried all the variants of quotation brackets at random. Not assigned. :)
You can either add a OnUpdateAction to the measure to set the variable, or use the measure directly as a variable using Section Variables
Kotofanchik
Posts: 95
Joined: March 15th, 2024, 7:30 pm

Re: WebParser: Local Files

Post by Kotofanchik »

RicardoTM wrote: March 27th, 2024, 3:34 am You can either add a OnUpdateAction to the measure to set the variable, or use the measure directly as a variable using Section Variables
This doesn’t help, I did as it was written and as it was not written and 25 more options and nothing works. :D

Code: Select all

[mCod]
Measure=WebParser
Url=file://#CURRENTPATH#Settings.inc
RegExp="(?siU)weather-.*-(.*)/.*"
stringindex=1
DynamicVariables=1

[mTotal]
Measure=WebParser
UpdateRate	=3600
Url			=https://services.gfore.net/inform-service/#hash_val#/forecast/?lang=#lang#&city=[#[&mCod]]
UserAgent	=#uagent#
RegExp		="(?siU)<location(.*)</location>"
Measure [mCod] now works, but [mTotal] doesn't work