It is currently April 20th, 2024, 7:39 am

Problems with WebParser and local log file

Get help with creating, editing & fixing problems with skins
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Problems with WebParser and local log file

Post by jsmorley »

Yincognito wrote: August 5th, 2021, 5:41 pm As far as I know, it's a bit of a bad practice to do such things in an exclusive mode, but then, that software probably has its reasons to do so...
Agreed.
Kosidive
Posts: 5
Joined: August 4th, 2021, 2:43 am

Re: Problems with WebParser and local log file

Post by Kosidive »

Thanks for all of the help. I ended up just using the RunCommand Plugin to copy the log. Now however, I'm having trouble with my regex not being able to parse the correct selection.

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
OnUpdateAction=[!CommandMeasure MeasureCopy Run]

[Metadata]
Name=WarframeLevel
Author=Kosidive
Information=Reads Level Data from Log File
Version=1.0
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[MeasureCopy]
Measure=Plugin
Plugin=RunCommand
Parameter=copy /y "C:\Users\%USERNAME%\AppData\Local\Warframe\EE.log" #CURRENTPATH#\EEcopy.log

[MeasureLevel]
Measure=WebParser
URL=file://#CURRENTPATH#\EEcopy.log
RegExp=(?si)Generated layout(.*)Found
UpdateRate=1
Debug=1
StringIndex=1


[MeterLevel]
Meter=String
MeasureName=MeasureLevel
FontSize=12
FontColor=255,255,255,255
StringEffect=Border
AntiAlias=1

[Background]
Meter=Image
W=1920
H=1080
SolidColor=0,0,0,0
BackgroundMode=2
Kosidive
Posts: 5
Joined: August 4th, 2021, 2:43 am

Re: Problems with WebParser and local log file

Post by Kosidive »

I am currently using this as my regex

Code: Select all

(?siU)Generated layout(.*)Found(?!Generated layout)
and it works just fine on regex101.com pcre. However when I try to use it with RainRegExp and Rainmeter, it only stores the first match. Is this intended behavior of the web parser regex, and how might I go around fixing this?
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Problems with WebParser and local log file

Post by death.crafter »

Kosidive wrote: August 11th, 2021, 12:22 am Thanks for all of the help. I ended up just using the RunCommand Plugin to copy the log. Now however, I'm having trouble with my regex not being able to parse the correct selection.

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
OnUpdateAction=[!CommandMeasure MeasureCopy Run]

[Metadata]
Name=WarframeLevel
Author=Kosidive
Information=Reads Level Data from Log File
Version=1.0
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[MeasureCopy]
Measure=Plugin
Plugin=RunCommand
Parameter=copy /y "C:\Users\%USERNAME%\AppData\Local\Warframe\EE.log" #CURRENTPATH#\EEcopy.log

[MeasureLevel]
Measure=WebParser
URL=file://#CURRENTPATH#\EEcopy.log
RegExp=(?si)Generated layout(.*)Found
UpdateRate=1
Debug=1
StringIndex=1


[MeterLevel]
Meter=String
MeasureName=MeasureLevel
FontSize=12
FontColor=255,255,255,255
StringEffect=Border
AntiAlias=1

[Background]
Meter=Image
W=1920
H=1080
SolidColor=0,0,0,0
BackgroundMode=2
In URLs you usually use / but even so #CURRENTPATH# already has a \, so the url needs to be:

file://#CURRENTPATH#EECopy.log

If it doesn't work try:

Code: Select all

[MeasureURI]
Measure=String
String=#CURRENTPATH#EECopy.log
Substitute="\":"/"

[MeasureLevel]
Measure=WebParser
URL="file://[MeasureURI]"
from the Realm of Death
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Problems with WebParser and local log file

Post by balala »

death.crafter wrote: August 11th, 2021, 12:41 am In URLs you usually use / but even so #CURRENTPATH# already has a \, so the url needs to be:

file://#CURRENTPATH#EECopy.log
Adding additional backslashes (\) is not a problem. Can add as many as you wish (see the PS here).
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Problems with WebParser and local log file

Post by balala »

Kosidive wrote: August 11th, 2021, 12:22 am Now however, I'm having trouble with my regex not being able to parse the correct selection.
Post an example of what is contained into the file you wish to parse.
User avatar
Yincognito
Rainmeter Sage
Posts: 7128
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Problems with WebParser and local log file

Post by Yincognito »

Kosidive wrote: August 11th, 2021, 12:26 am I am currently using this as my regex

Code: Select all

(?siU)Generated layout(.*)Found(?!Generated layout)
and it works just fine on regex101.com pcre. However when I try to use it with RainRegExp and Rainmeter, it only stores the first match. Is this intended behavior of the web parser regex, and how might I go around fixing this?
Yes, it's the intended behavior. In Rainmeter, only the Substitute option regexes are global (like on regex101.com, when the /g flag is used), the WebParser ones are not. To capture the rest you'd need to repeat your pattern accordingly, something along these lines:

Code: Select all

(?siU)Generated layout(.*)Found(?!Generated layout).*Generated layout(.*)Found(?!Generated layout)
obviously adjusted to your actual parsed content. Better post here an example of that content like balala suggested, so folks can help you with that if you can't figure it out. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Kosidive
Posts: 5
Joined: August 4th, 2021, 2:43 am

Re: Problems with WebParser and local log file

Post by Kosidive »

Yincognito wrote: August 11th, 2021, 12:20 pm Yes, it's the intended behavior. In Rainmeter, only the Substitute option regexes are global (like on regex101.com, when the /g flag is used), the WebParser ones are not. To capture the rest you'd need to repeat your pattern accordingly, something along these lines:

Code: Select all

(?siU)Generated layout(.*)Found(?!Generated layout).*Generated layout(.*)Found(?!Generated layout)
obviously adjusted to your actual parsed content. Better post here an example of that content like balala suggested, so folks can help you with that if you can't figure it out. ;-)
That weird behavior. Would there be a way to to make it act like the Substitute regexes. Using the repeated way would only let me load up to 99 Layouts because of the String index cap. I am also going to upload a example log that has all of the excess trimmed and 3 layouts loaded
EE.log
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 7128
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Problems with WebParser and local log file

Post by Yincognito »

Kosidive wrote: August 20th, 2021, 11:07 pm That weird behavior. Would there be a way to to make it act like the Substitute regexes. Using the repeated way would only let me load up to 99 Layouts because of the String index cap. I am also going to upload a example log that has all of the excess trimmed and 3 layouts loadedEE.log
You can easily get past the 99 captures limit by using some strategic capture structuring and the StringIndex2 option. More info on that here. If you still don't understand how to use it, you'd have to post a sample of the content that you're parsing, so we can help (EDIT: correction, you already did this, in a simple form). In essence though, it's really simple: the StringIndex featured measures act like the "children" of the (main) WebParser "parent" measure, while the StringIndex2 featured measures act like "grandchildren" of the WebParser "parent" measure, since they can logically be considered the "children" of the StringIndex featured measures. Of course, technically, both are children of the WebParser parent measure, I just said the above to have an idea how stuff is logically structured.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Kosidive
Posts: 5
Joined: August 4th, 2021, 2:43 am

Re: Problems with WebParser and local log file

Post by Kosidive »

Yincognito wrote: August 21st, 2021, 12:09 am You can easily get past the 99 captures limit by using some strategic capture structuring and the StringIndex2 option. More info on that here. If you still don't understand how to use it, you'd have to post a sample of the content that you're parsing, so we can help (EDIT: correction, you already did this, in a simple form). In essence though, it's really simple: the StringIndex featured measures act like the "children" of the (main) WebParser "parent" measure, while the StringIndex2 featured measures act like "grandchildren" of the WebParser "parent" measure, since they can logically be considered the "children" of the StringIndex featured measures. Of course, technically, both are children of the WebParser parent measure, I just said the above to have an idea how stuff is logically structured.
I understand that part, however, how would it get it to display only the newest one.