Hi, so i have entered a couple topics in relation to a new feature of a weather skin.
This being the latest is in relation to a parsed string from weather.com.
I have a timestamp that is formatted [mm/dd/yy hh:mm am/pm timezone]
All i really wish to have is the [hh:mm am/pm] part.
Since the string is parsed from a rather long RegExp, there should be a Substitute= for the Measure=Plugin
Plugin=Plugins\WebParser.dll measure?
What would that look like?
I am terrible at this sort of thing. Perhaps one day I will figure it out on my own...
It is currently April 26th, 2024, 1:27 pm
Parsed string from weather.com
-
- Posts: 943
- Joined: May 7th, 2016, 7:32 am
Parsed string from weather.com
My DevArt Gallery
There are many ways to be different - there is only one way to be yourself - be amazing at it
The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
There are many ways to be different - there is only one way to be yourself - be amazing at it
The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
-
- Developer
- Posts: 22630
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Parsed string from weather.com
So if I fake it with a String measure:Mor3bane wrote:Hi, so i have entered a couple topics in relation to a new feature of a weather skin.
This being the latest is in relation to a parsed string from weather.com.
I have a timestamp that is formatted [mm/dd/yy hh:mm am/pm timezone]
All i really wish to have is the [hh:mm am/pm] part.
Since the string is parsed from a rather long RegExp, there should be a Substitute= for the Measure=Plugin
Plugin=Plugins\WebParser.dll measure?
What would that look like?
I am terrible at this sort of thing. Perhaps one day I will figure it out on my own...
Code: Select all
[MeasureString]
Measure=String
String=[01/31/18 14:06 am EST]
RegExpSubstitute=1
Substitute="^\[(.*) .*$":"\1"
Substitute="^\[(.*) .*$":"\1"
Start at the beginning of the string ^ and find a [ character, which must be escaped \ because it is a reserved character in regular expression. Then capture all characters (.*) until the last space is found, then skip all characters .* until the end of the string $. Replace the entire string with what I captured as capture group #1 \1.
You do not have the required permissions to view the files attached to this post.
-
- Developer
- Posts: 22630
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Parsed string from weather.com
Extra credit:
If you in fact want to keep the [ and ] characters at the start and end, that is a bit tricky.
The issue is that using "[\1]" as the "replacement" has a problem. Anything inside [brackets] in an option will attempt to resolve to a [SectionVariable], and you will end up with just [] as there is no measure called [\1]. So we need to fool it into not trying to do that.
So we go ahead and let it (capture) the leading [ character, then just force a trailing ] character at the end of the "repalcement", so we end up with:
If you in fact want to keep the [ and ] characters at the start and end, that is a bit tricky.
The issue is that using "[\1]" as the "replacement" has a problem. Anything inside [brackets] in an option will attempt to resolve to a [SectionVariable], and you will end up with just [] as there is no measure called [\1]. So we need to fool it into not trying to do that.
Code: Select all
[MeasureString]
Measure=String
String=[01/31/18 14:06 am EST]
RegExpSubstitute=1
Substitute="^(.*) .*$":"\1]"
You do not have the required permissions to view the files attached to this post.
-
- Rainmeter Sage
- Posts: 16172
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Parsed string from weather.com
I think a better solution would be to get separately the month, the day, year, hour, minutes am/pm and the time zone, then use the needed information, from these. Probably the RegExp option of the parent WebParser measure could be modified to get those values one by one, instead of the whole date-time string. This would avoid the need of the substitution.Mor3bane wrote:I have a timestamp that is formatted [mm/dd/yy hh:mm am/pm timezone]
All i really wish to have is the [hh:mm am/pm] part.
WebParser isn't any more a plugin, it's a measure now.Mor3bane wrote:Since the string is parsed from a rather long RegExp, there should be a Substitute= for the Measure=Plugin
Plugin=Plugins\WebParser.dll measure?
-
- Developer
- Posts: 22630
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Parsed string from weather.com
I think that would be quite tricky to get and keep the [ and ] characters that he specified are part of the string, but yes, in principle I agree with you. I was just responding to the question as it was framed.balala wrote:I think a better solution would be to get separately the month, the day, year, hour, minutes am/pm and the time zone, then use the needed information, from these. Probably the RegExp option of the parent WebParser measure could be modified to get those values one by one, instead of the whole date-time string. This would avoid the need of the substitution.
WebParser isn't any more a plugin, it's a measure now.
-
- Rainmeter Sage
- Posts: 16172
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Parsed string from weather.com
Are those brackets part of the got information? I'm not sure they would be.jsmorley wrote:I think that would be quite tricky to get and keep the [ and ] characters that he specified are part of the string, but yes, in principle I agree with you. I was just responding to the question as it was framed.
However, I also took that solution into account, but finally I thought getting separately those information would be a better one. But if it indeed is, depends on a few things, so let's see what Mor3bane will say.
-
- Developer
- Posts: 22630
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Parsed string from weather.com
Yes, the other issue with parsing them separately is that we can't be sure just from what he said if it would be:balala wrote:Are those brackets part of the got information? I'm not sure they would be.
However, I also took that solution into account, but finally I thought getting separately those information would be a better one. But if it indeed is, depends on a few things, so let's see what Mor3bane will say.
[01/31/18 03:06 am EST]
or
[1/31/18 3:06 am EST]
Then we are into some complicated regular expression I fear.
But if his intent is to ever use this information to determine "how old" some entry is, it's pointless to get the entire string, as then you just add tons of work to tear it apart later into the elements you need to derive a timestamp from a Time measure. As you say, we need more clarity on this.
-
- Rainmeter Sage
- Posts: 16172
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Parsed string from weather.com
Right. Let's see what tell Mor3bane.jsmorley wrote:Yes, the other issue with parsing them separately is that we can't be sure just from what he said if it would be:
[01/31/18 03:06 am EST]
or
[1/31/18 3:06 am EST]
Then we are into some complicated regular expression I fear.
-
- Posts: 943
- Joined: May 7th, 2016, 7:32 am
Re: Parsed string from weather.com
Hi,
Wow. Thanks for the replies.
The "[]" were simply put in to identify the actual output of my weather meter. The code:
So I am not using the String Measure, but a String Meter.
The actual output is by example like this:
2/01/18 8:00 AM PEST
That is the literal output from the code shown above, at the time of my posting it - spaces included as seen in the skin output.
I was trying to get the time and am or pm definer only for the final output.
Wow. Thanks for the replies.
The "[]" were simply put in to identify the actual output of my weather meter. The code:
Code: Select all
[MeasureTimeStamp]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureCurrent]
StringIndex=15
UpdateDivider=50
[MeterTimeStamp]
Meter=String
MeasureName=MeasureTimeStamp
FontFace=#Font#
FontColor=#ColorZ#
FontSize=20
StringAlign=Center
X=168
Y=85
Text=%1
AntiAlias=1
The actual output is by example like this:
2/01/18 8:00 AM PEST
That is the literal output from the code shown above, at the time of my posting it - spaces included as seen in the skin output.
I was trying to get the time and am or pm definer only for the final output.
My DevArt Gallery
There are many ways to be different - there is only one way to be yourself - be amazing at it
The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
There are many ways to be different - there is only one way to be yourself - be amazing at it
The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
-
- Posts: 943
- Joined: May 7th, 2016, 7:32 am
Re: Parsed string from weather.com
I just noticed the statement that the WebParser is no longer a plugin but a measure.balala wrote: WebParser isn't any more a plugin, it's a measure now.
I will edit for the future after consulting the RM Manual to ensure I am doing it right now.
My DevArt Gallery
There are many ways to be different - there is only one way to be yourself - be amazing at it
The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
There are many ways to be different - there is only one way to be yourself - be amazing at it
The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.