Page 1 of 1

Webparser Fail on missing StringIndex

Posted: December 13th, 2017, 9:47 am
by Ashtefere
I am currently building a steam friend lister for my skin.

I am parsing only 'in-game' friends for steam so it is easy to join a game already going.

The issue I have is that the amount of people in-game is always random.

I have solved the meter display issue by hiding if stringmatch = "". This way, only the amount of meters matching the users in-game are displayed.

The root of the problem is the Regex for the Friend parser - if my regex expects a friend element and its not there, the whole skin crashes.

Is there a way to get the webparser to 'continue' even if the stringindex regex returns null for a stringindex?

Re: Webparser Fail on missing StringIndex

Posted: December 13th, 2017, 12:45 pm
by balala
What you need is probably the Lookahead Assertion. When used, the WebParser measures return the needed strings if those exist, otherwise empty strings are returned, avoiding the errors.
This is the basic. For specific help please post the code you have so far.

Re: Webparser Fail on missing StringIndex

Posted: December 18th, 2017, 5:39 am
by Ashtefere
Thanks, exactly what I needed!

Any way to stop the log spamming of "Not enough substrings"?

Re: Webparser Fail on missing StringIndex

Posted: December 18th, 2017, 1:00 pm
by balala
Ashtefere wrote:Thanks, exactly what I needed!
But did you get it working well?
Ashtefere wrote:Any way to stop the log spamming of "Not enough substrings"?
Depends on the used code. Not knowing it, I can't tell more. Maybe if you'd post it.

Re: Webparser Fail on missing StringIndex

Posted: December 18th, 2017, 4:28 pm
by eclectic-tech
Ashtefere wrote:... Any way to stop the log spamming of "Not enough substrings"?
You need to add this to your webparser measure LogSubstringErrors=0

Re: Webparser Fail on missing StringIndex

Posted: December 18th, 2017, 4:55 pm
by balala
:o
eclectic-tech wrote:You need to add this to your webparser measure LogSubstringErrors=0
:o
I said a few times before: Rainmeter can always surprise me. I think I have a bit of experience coding in Rainmeter, but had no idea about this option. Not the only time when you or someone else (or even me) find a simple solution for a problem.
Thanks eclectic-tech for this info.
:o

Re: Webparser Fail on missing StringIndex

Posted: December 19th, 2017, 2:37 am
by eclectic-tech
The Rainmeter manual is constantly evolving. :) It's easy to miss new (or recently added) features. :welcome:

Re: Webparser Fail on missing StringIndex

Posted: December 19th, 2017, 1:29 pm
by balala
eclectic-tech wrote:It's easy to miss new (or recently added) features. :welcome:
I think that's not a such recently added feature (at least I couldn't find it in the News & Announcements section of the forum), so it seems I missed it.

Re: Webparser Fail on missing StringIndex

Posted: December 19th, 2017, 1:49 pm
by jsmorley
balala wrote:I think that's not a such recently added feature (at least I couldn't find it in the News & Announcements section of the forum), so it seems I missed it.
March 12, 2016 - Revision 2593

https://docs.rainmeter.net/history/#r2593

Generally, only bigger changes are posted in "Change Announcements" here on the forums. For all changes, you might follow the release notes for the beta versions, https://www.rainmeter.net/beta-4-2, or the History page https://docs.rainmeter.net/history/, or you can get REALLY down in the weeds at https://github.com/rainmeter/rainmeter/commits/master.