It is currently September 16th, 2024, 7:19 pm

Can't pass measure value to web parser

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 8153
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Can't pass measure value to web parser

Post by Yincognito »

Kotofanchik wrote: June 28th, 2024, 8:36 pmOh, no, it doesn’t always work, not for all places. We still have to rack our brains.
Technically, it will work everywhere you use it, if the "Settings.inc" parameter is the correct path and enclosed in quotes, and "[mFullDate]" has a value and is also enclosed in quotes. If by anychance you have quotes inside the [mFullDate] value, you'd have to increase the number of quote pairs enclosing the said value, like ""[mFullDate]"" and such. Also, careful at errors in your logic, since, as I said before:
Yincognito wrote: June 27th, 2024, 11:57 pmI'm afraid that the correct way is in the FinishAction of [mTotal], like I explained in my example. It's merely a coincidence that putting those bangs in the IfTrueAction seems to work, because everything after [!CommandMeasure mTotal Update] will happen before it (instead of right after it), since retrieving data from the web resource is, once again, not immediate.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Kotofanchik
Posts: 158
Joined: March 15th, 2024, 7:30 pm

Re: Can't pass measure value to web parser

Post by Kotofanchik »

Is it possible to get the full number of seconds from a full date and time using a timestamp? I can’t figure out a simpler way to compare full dates?
User avatar
Yincognito
Rainmeter Sage
Posts: 8153
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Can't pass measure value to web parser

Post by Yincognito »

Kotofanchik wrote: June 29th, 2024, 9:28 am Is it possible to get the full number of seconds from a full date and time using a timestamp? I can’t figure out a simpler way to compare full dates?
Of course, just use the :Timestamp parameter on an equivalent Time (not String, not WebParser!) measure and compare stuff like that, e.g. [Time1:Timestamp]<[Time2:Timestamp] in either an IfCondition, a Calc measure, or a numeric conditional:
https://docs.rainmeter.net/manual/variables/section-variables/#Timestamp
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Kotofanchik
Posts: 158
Joined: March 15th, 2024, 7:30 pm

Re: Can't pass measure value to web parser

Post by Kotofanchik »

I need to compare two times obtained from regexp, will this not work?
User avatar
Yincognito
Rainmeter Sage
Posts: 8153
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Can't pass measure value to web parser

Post by Yincognito »

Kotofanchik wrote: June 29th, 2024, 11:53 am I need to compare two times obtained from regexp, will this not work?
It will work, but you'll need to pass those times to actual / equivalent Time measures that you create with the Timestamp and TimeStampFormat options. Then in the comparison, use the newly created Time measures with the :Timestamp parameter. It's all in the manual, you know...
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16549
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Can't pass measure value to web parser

Post by balala »

Kotofanchik wrote: June 29th, 2024, 11:53 am I need to compare two times obtained from regexp, will this not work?
As Yincognito said, it'll work, but you need additional steps. So, questions are:
  • Which skin are you working with? This one, or another (in last case let us know which one)?
  • Which measures are returning the times you want / need to compare?
I (we) need to know these in order to can give you more specific help.
User avatar
Yincognito
Rainmeter Sage
Posts: 8153
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Can't pass measure value to web parser

Post by Yincognito »

balala wrote: June 29th, 2024, 12:42 pmThis one
You have a malformed [url=...] link there - probably autocorrect or something.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Kotofanchik
Posts: 158
Joined: March 15th, 2024, 7:30 pm

Re: Can't pass measure value to web parser

Post by Kotofanchik »

The skin is the one in this thread. I decided to compare the times on the site in order to find the hourly forecast time as close as possible to the site validation time.. Since the site works very differently in different cities, I could not expand the previous option for all cases, despite the correct logic for a large number of comparisons unstable work began. I tried to do what I read. Here's a piece. All together does not want to work at all. I don’t understand the recording format, why would there be a time stamp after the time stamp? The skin is wildly buggy. I've tried all the comparison signs, but I don't think there's any response.

Code: Select all

[mstartHour00]
Measure		=Plugin
Plugin		=WebParser
Url			=[mTotal]
RegExp		="(?siU)#startHour00##startHour00##startHour00##startHour00##startHour00##startHour00##startHour00##startHour00##startHour00##startHour00##startHour00##startHour00##startHour00##startHour00##startHour00##startHour00#"
StringIndex	=1
StringIndex2=1
.
.
[mstart16m]
Measure		=Plugin
Plugin		=WebParser
Url			=[mstartHour00]
StringIndex	=16
.
.
[H16]
Measure=Time
TimeStampFormat=%Y-%m-%dT%H:%M:%S
TimeStamp=[mstart16m]
Format=%Y-%m-%dT%H:%M:%S
DynamicVariables=1
.
.

[mfullDate]
Measure		=Plugin
Plugin		=WebParser
Url			=[mTotal]
RegExp		="(?siU)#fullDate#"
StringIndex	=1
StringIndex2=1
;IfCondition=(mfullDate > 0)
;IfTrueAction=[!CommandMeasure mTotal Update][!SetOption MeasureDayMMW_1 TimeStamp "[mfullDate]"][!UpdateMeasure MeasureDayMMW_1][!Redraw]

[mfullDateTime]
Measure=Time
TimeStampFormat=%Y-%m-%dT%H:%M:%S
TimeStamp=[mfullDate]
Format=%Y-%m-%dT%H:%M:%S
DynamicVariables=1

[McalcTimeCN]
Measure=calc
Formula=H16:mstart16m <= mfullDateTime:mfullDate ? 16 : (((H15:mstart15m <= mfullDateTime:mfullDate) ? 15 : ((H14:mstart14m <= mfullDateTime:mfullDate) ? 14 : ((H13:mstart13m <= mfullDateTime:mfullDate) ? 13 : ((H12:mstart12m <= mfullDateTime:mfullDate) ? 12 : ((H11:mstart11m <= mfullDateTime:mfullDate) ? 11 : ((H10:mstart10m <= mfullDateTime:mfullDate) ? 10 : ((H9:mstart9m <= mfullDateTime:mfullDate) ? 9 : ((H8:mstart8m <= mfullDateTime:mfullDate) ? 8 : ((H7:mstart7m <= mfullDateTime:mfullDate) ? 7 : ((H6:mstart6m <= mfullDateTime:mfullDate) ? 6 : ((H5:mstart5m <= mfullDateTime:mfullDate) ? 5 : ((H4:mstart4m <= mfullDateTime:mfullDate) ? 4 : ((H3:mstart3m <= mfullDateTime:mfullDate) ? 3 : ((H2:mstart2m <= mfullDateTime:mfullDate) ? 2 : ((H1:mstart1m <= mfullDateTime:mfullDate) ? 1 : 0))))))))))))))))
DynamicVariables=1
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 8153
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Can't pass measure value to web parser

Post by Yincognito »

Kotofanchik wrote: June 29th, 2024, 2:36 pm The skin is the one in this thread. I decided to compare the times on the site in order to find the hourly forecast time as close as possible to the site validation time.. Since the site works very differently in different cities, I could not expand the previous option for all cases, despite the correct logic for a large number of comparisons unstable work began. I tried to do what I read. Here's a piece. All together does not want to work at all. I don’t understand the recording format, why would there be a time stamp after the time stamp? The skin is wildly buggy. I've tried all the comparison signs, but I don't think there's any response.
Try like this:

Code: Select all

[McalcTimeCN]
Measure=calc
Formula=[H16:Timestamp] <= [mfullDateTime:Timestamp] ? 16 : ...and so on, you get the idea...
DynamicVariables=1
Of course, this measure and the other Time measures involved should normally be updated from the FinishAction of [mTotal] (just like in the previous case), in order to perform the comparisons and have a meaningful value with the data retrieved from the site and after retrieving it. Might worth adding all of them to a group and update that group instead, so you don't have to write a line as long as the Milky Way made up of update bangs of every individual measure.

EDIT: By the way, your original code part is actually comparing the plain numeric value of those measures, which in all cases is 2024, as you can see in the log from your screenshot. It wasn't comparing the timestamps, i.e. the number of seconds since Jan 1, 1601.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Kotofanchik
Posts: 158
Joined: March 15th, 2024, 7:30 pm

Re: Can't pass measure value to web parser

Post by Kotofanchik »

I think about my mistakes
Yes, I did as written, the right time was found
Last edited by Kotofanchik on June 29th, 2024, 3:29 pm, edited 1 time in total.