It is currently March 28th, 2024, 4:13 pm

Webparser Fail on missing StringIndex

Get help with creating, editing & fixing problems with skins
Post Reply
Ashtefere
Posts: 7
Joined: December 13th, 2017, 9:42 am

Webparser Fail on missing StringIndex

Post 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?
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Webparser Fail on missing StringIndex

Post 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.
Ashtefere
Posts: 7
Joined: December 13th, 2017, 9:42 am

Re: Webparser Fail on missing StringIndex

Post by Ashtefere »

Thanks, exactly what I needed!

Any way to stop the log spamming of "Not enough substrings"?
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Webparser Fail on missing StringIndex

Post 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.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5382
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: Webparser Fail on missing StringIndex

Post 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
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Webparser Fail on missing StringIndex

Post 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
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5382
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: Webparser Fail on missing StringIndex

Post by eclectic-tech »

The Rainmeter manual is constantly evolving. :) It's easy to miss new (or recently added) features. :welcome:
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Webparser Fail on missing StringIndex

Post 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.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Webparser Fail on missing StringIndex

Post 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.
Post Reply