It is currently April 27th, 2024, 6:24 pm

Updating Variable from RegEx

Get help with creating, editing & fixing problems with skins
Lars
Posts: 5
Joined: January 6th, 2024, 2:56 pm

Updating Variable from RegEx

Post by Lars »

Hi all, i have a question where i didn't find an answer for hours in Google...
I want to update a dynamic variable with the value from the Regex... it didn't work :-)
Can please someone help?
Thanks and all the best,

Lars

Code: Select all

[Link]
Measure=WebParser
URL=https://www.xxxxx.de?show=all
StringIndex=1
RegExp=(?siU)value_from_url":(.*),
StringIndex2=1
Substitute="":"--"
DynamicVariables=1
OnUpdateAction=[!SetVariable statistiklink #RegExp#]
Last edited by SilverAzide on January 6th, 2024, 3:46 pm, edited 1 time in total.
Reason: Please use code tags when posting code. It's the </> button.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2613
Joined: March 23rd, 2015, 5:26 pm

Re: Updating Variable from RegEx

Post by SilverAzide »

Lars wrote: January 6th, 2024, 3:05 pm Hi all, i have a question where i didn't find an answer for hours in Google...
I want to update a dynamic variable with the value from the Regex... it didn't work :-)
Can please someone help?
Thanks and all the best,

Lars
The problem is that "the value from the Regex" isn't a thing. The RegExp option is what you set to parse the string returned from the URL. The result of the parsing will be stored in the measure itself (that's what measures do). So what you want is something like this:

Code: Select all

OnUpdateAction=[!SetVariable statistiklink [Link]]
I didn't try it, however. (You can also use OnUpdateAction=[!SetVariable statistiklink #CURRENTSECTION#].) This should work assuming your measure returns the result you are expecting.
Gadgets Wiki GitHub More Gadgets...
Lars
Posts: 5
Joined: January 6th, 2024, 2:56 pm

Re: Updating Variable from RegEx

Post by Lars »

Thank you it is working :-)
You are awesome!

All the best,

Lars