It is currently April 27th, 2024, 4:12 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

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

Post by Kotofanchik »

Yincognito wrote: March 27th, 2024, 2:35 pm Oh, now I see where the problem is - you still want to find the "cod" in the site's address. Well, if that's the case, you can use WebParser as before. You could use @include as above too, store the entire address in the variable, then use a RegExpSubstitute=1 / Substitute in a String measure to which you pass the value of the variable, to extract only the "cod" from that variable, but it's more or less the same thing as using the WebParser approach.

In any case, I still think you're overcomplicating things, but well, if it works, then it should do it.
I don't understand. Am I doing all this or not? but it doesn't want to work properly.
works only once and then not completely
Kotofanchik
Posts: 95
Joined: March 15th, 2024, 7:30 pm

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

Post by Kotofanchik »

This is starting to look terrible, I don’t understand how such a seemingly simple task turns out to be fantastically difficult. Finding a specific word in a file and reading that word from the file and not being able to fully use it except by writing it back to the same file cannot be necessary. :)
How to update
DynamicVariables=1
FinishAction=[!CommandMeasure mTotal "Update"]
not only when starting the rainmeter, but also when updating the weather?
Why do some measere stop reading information, while others continue to read it?
Apparently nothing will work out; it’s easier to teach a person to parse a website address and find the right word there and remember it in a file. :)
I’m afraid to let the rainmeter record something, because I don’t know how to do it, I’m afraid I’ll write down the wrong thing and in the wrong place.
:rosegift:
Kotofanchik
Posts: 95
Joined: March 15th, 2024, 7:30 pm

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

Post by Kotofanchik »

and I really don’t understand how @include can help, if the Measures.inc file already exists
[Variables]
@Include=Settings.inc
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5407
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

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

Post by eclectic-tech »

Kotofanchik wrote: March 27th, 2024, 3:01 pm and I really don’t understand how @include can help, if the Measures.inc file already exists
[Variables]
@Include=Settings.inc
You should consider creating a rmskin package, so we have all of your code and @include files.
We need all of that detail in order to help you.

You CAN use the value returned by Webparser without needing to save it to a variable or writing it to a file.
Note: When using !WriteKeyValue, that new value is NOT available until the skin is refreshed, so, to use the new value before a refresh, you MUST also use !SetVariable to set the same value you '"wrote" in the !WriteKeyValue bang.

DynamicVariables=1 must be used in every section you use a variable (or Section Variable) when that value can be changed before a skin refresh.

When you say "it doesn't work a second time" that does not help us, when and how are you using it a second time? Remember Webparser measures can only be updated using the !CommandMeasure WebparserParent "Update". Using !UpdateMeasure WebparserParent will only increment the UpdateRate of the Webparser measure by 1, but will not update the measure.

As mentioned, it appears you are making this more complicated than it needs, but without more info we cannot determine the best advice.
User avatar
Yincognito
Rainmeter Sage
Posts: 7177
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

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

Post by Yincognito »

Kotofanchik wrote: March 27th, 2024, 2:53 pm I don't understand. Am I doing all this or not? but it doesn't want to work properly.
works only once and then not completely
Keep the WebParser method as laid out by eclectic-tech (and me) for now - that's all you need to know at this time. You said it works, so it should be enough. Yes, it will work once at skin load / refresh time, and then wait for 3600 seconds = 1 hour = Update x UpdateRate = 1000 x 3600 = 3600000 ms as per your code, until it requests the data again from the site. This is normal, the skin will behave like you code it too. If you really really need more frequent requests, adjust the UpdateRate to a lower value (although I'd keep a reasonable frequency for the requests, exaggerating might get you banned).
Kotofanchik wrote: March 27th, 2024, 2:55 pm This is starting to look terrible, I don’t understand how such a seemingly simple task turns out to be fantastically difficult. Finding a specific word in a file and reading that word from the file and not being able to fully use it except by writing it back to the same file cannot be necessary. :)
How to update
DynamicVariables=1
FinishAction=[!CommandMeasure mTotal "Update"]
not only when starting the rainmeter, but also when updating the weather?
Why do some measere stop reading information, while others continue to read it?
Apparently nothing will work out; it’s easier to teach a person to parse a website address and find the right word there and remember it in a file. :)
I’m afraid to let the rainmeter record something, because I don’t know how to do it, I’m afraid I’ll write down the wrong thing and in the wrong place.
:rosegift:
It's not terrible, things will work out and you don't need to be afraid. These are just your beginner fears and they'll pass. The reason why you have them is because you don't understand (yet) how stuff works. The WebParser method and the @include one are alternatives to one another, they will mostly do the same thing in this case, but since the WebParser method has been clearly laid out and you confirmed that it works, you can keep it in your code. ;-)

Things are not complicated. BUT you'll need to understand the principle (as with everything in life) and then everything will look easy. A part of the problem in this case is that you didn't share all the details of your code, just parts of it (not a problem for me, just saying). The main point here is that if you modify something (the value of a variable, a measure, that kind of things), then you'll need to update the related sections to reflect that change. It's logical. So, coming back to what I said earlier, if - by any chance, this was hypothetical - you do change the "cod" value via a !SetVariable, you'll need to request the data from the site again by using the [!CommandMeasure YourWebParserMeasure "Update"] bang. It can't be any other way, since the address will change as well for the new request.
Kotofanchik wrote: March 27th, 2024, 3:01 pm and I really don’t understand how @include can help, if the Measures.inc file already exists
[Variables]
@Include=Settings.inc
You DID NOT share your entire code (as advised by balala earlier), so we don't have any clue as to what Measures.inc contains. However, IF that only includes measures (i.e. no [Variables] section), there's no contradiction. With your @Include=#CURRENTPATH#Settings.inc, you only include some variables in your skin, just as they would be written in the .ini itself. That's not hard to understand, if you read the little bits from the manual detailing this. We - the more experienced users here on the forum - should not have to repeat what the manual already says, we should only clarify or add to that info some tricks, methods, or info that is not apparent in a straightforward manner in the manual.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Kotofanchik
Posts: 95
Joined: March 15th, 2024, 7:30 pm

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

Post by Kotofanchik »

You DID NOT share your entire code (as advised by balala earlier), so we don't have any clue as to what Measures.inc contains. However, IF that only includes measures (i.e. no [Variables] section), there's no contradiction. With your @Include=#CURRENTPATH#Settings.inc, you only include some variables in your skin, just as they would be written in the .ini itself. That's not hard to understand, if you read the little bits from the manual detailing this. We - the more experienced users here on the forum - should not have to repeat what the manual already says, we should only clarify or add to that info some tricks, methods, or info that is not apparent in a straightforward manner in the manual.
I don't understand at all what @Include has to do with it. This is so incredibly incomprehensible what you want to tell me
I know very well how @Include works, but I don’t understand at all why you mention it and how it can help me even in the slightest degree, it’s just kind of mind-blowing.
It may help, but how? I can put everything in one file and everything will work, but how will this help me?
And unfortunately I had to abandon this decision altogether. The skin incredibly began to disrupt the work of the entire Rhinemeter.

I'm desperate.
User avatar
Yincognito
Rainmeter Sage
Posts: 7177
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

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

Post by Yincognito »

Kotofanchik wrote: March 27th, 2024, 7:02 pm I don't understand at all what @Include has to do with it. This is so incredibly incomprehensible what you want to tell me
I know very well how @Include works, but I don’t understand at all why you mention it and how it can help me even in the slightest degree, it’s just kind of mind-blowing.
It may help, but how? I can put everything in one file and everything will work, but how will this help me?
And unfortunately I had to abandon this decision altogether. The skin incredibly began to disrupt the work of the entire Rhinemeter.

I'm desperate.
Using @include would simplify your code, IF you had only the actual "cod" value as a variable. That's all.
Since you don't, however, using WebParser to parse the Settings.inc file is the SAME thing as using an @include for it, a String measure getting the included variable, and some regex Substitute that will extract only the "cod" part from your entire address that is presumably stored in the included variable.

So basically, what I'm trying to say is that @include would automatically parse the file for you, if it was suited to be used in this case (which apparently isn't, given that you still need to extract "cod" from the address), cancelling the need to have all kinds of WebParsers to parse the file and look for some value.

Relax, this is far from being something to be desperate about. It's just a skin, not a life and death situation... :)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Kotofanchik
Posts: 95
Joined: March 15th, 2024, 7:30 pm

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

Post by Kotofanchik »

Yincognito wrote: March 27th, 2024, 7:13 pm Using @include would simplify your code, IF you had only the actual "cod" value as a variable. That's all.
Since you don't, however, using WebParser is the SAME thing as using an @include, a String measure getting the included variable, and some regex Substitute that will extract only the "cod" part from your entire address that is presumably stored in the included variable.

Relax, this is far from being something to be desperate about. It's just a skin, not a life and death situation... :)
This sounds monstrously incomprehensible, how? how can @include simplify something? I don't understand you at all. to me it sounds like using moon would simplify the code, what's the connection? I'm using @include just for convenience, but how might this affect the code? I don't see the slightest similarity between @include and WebParser. I can't quite understand what you're talking about. For me these are completely incomparable things. I'm at a loss as to what's going on.
User avatar
Yincognito
Rainmeter Sage
Posts: 7177
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

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

Post by Yincognito »

Kotofanchik wrote: March 27th, 2024, 7:19 pm This sounds monstrously incomprehensible, how? how can @include simplify something? I don't understand you at all. to me it sounds like using moon would simplify the code, what's the connection? I'm using @include just for convenience, but how might this affect the code? I don't see the slightest similarity between @include and WebParser. I can't quite understand what you're talking about. For me these are completely incomparable things. I'm at a loss as to what's going on.
I was just editing my previous reply when I saw yours, but it all boils down to:
Yincognito wrote: March 27th, 2024, 7:13 pmSo basically, what I'm trying to say is that @include would automatically parse the file for you, if it was suited to be used in this case (which apparently isn't, given that you still need to extract "cod" from the address), cancelling the need to have all kinds of WebParsers to parse the file and look for some value.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Kotofanchik
Posts: 95
Joined: March 15th, 2024, 7:30 pm

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

Post by Kotofanchik »

Yincognito wrote: March 27th, 2024, 7:13 pm Using @include would simplify your code, IF you had only the actual "cod" value as a variable. That's all.
I'm currently using @include and actual "cod" value as a variable. I want to give this up.