Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 1576

Help: Rainmeter Skins • Re: CurrentObservationTime - Time measure to calculate X-position in shape meter

$
0
0
Can anybody show me a working measure giving this numerical value based on [@CurrentObservationTime] to be used in the shape meter? Thanks so much.
Since all parameters of a Line elements of a Shape option have to be numbers, you can't use there what the [@CurrentObservationTime] measure does return, because that's not a number, as you could see in the error message:
Formula: Logical expression error: (100+3*15:45)
You can't multiply 3 by 15:45, because this last value is not a number. Accordingly the appropriate elements of the Shape meter can't be calculated. But I think you've figured this out by yourself.
So, as Yincognito mentioned, there are two way to achieve what you want:
  • - use that string in a Time measure, then use its Timestamp, TimestampFormat and [YourTimeMeasure:Timestamp] to convert the string into a decimal numerical representation:
    https://docs.rainmeter.net/manual/measures/time/
    To use this approach, add the following measures to your code:

    Code:

    [@CurrentObservationTime]...[MeasureToday]Measure=TimeFormat=%Y.%m.%d[MeasureTimeStamp]Measure=TimeTimeStamp=[MeasureToday] [@CurrentObservationTime]TimeStampFormat=%Y.%m.%d %H:%MDynamicVariables=1[MeasureMidnight]Measure=TimeFormat=%Y.%m.%d %H:%MTimeStamp=[MeasureToday] 0:00TimeStampFormat=%Y.%m.%d %#H:%MDynamicVariables=1[MeasureDecimalTime]Measure=CalcFormula=( [MeasureTimeStamp:TimeStamp] - [MeasureMidnight:TimeStamp] )DynamicVariables=1
    [MeasureDecimalTime] returns the decimal number calculated as you need it.
  • - use a (regex) Substitute in a String measure that has your [@CurrentObservationTime] as its value, to transform the "15:45" string into a "(15*60+45)" one or similar, so that the latter can be used directly in your Shape formula
    For this approach you need the following measures:

    Code:

    [@CurrentObservationTime]...[MeasureHour]Measure=STRINGString=[@CurrentObservationTime]RegExpSubstitute=1Substitute="(\d{1,2}):(\d{2})":"\1"DynamicVariables=1[MeasureMinute]Measure=STRINGString=[@CurrentObservationTime]RegExpSubstitute=1Substitute="(\d{1,2}):(\d{2})":"\2"DynamicVariables=1[MeasureDecimalTime]Measure=CalcFormula=( [MeasureHour] + [MeasureMinute] / 60 )DynamicVariables=1
    Same way as previously, [MeasureDecimalTime] returns the needed time as a decimal number.
You can use any of these approaches. Please come back if any question arises related to any of them.

Statistics: Posted by balala — Yesterday, 5:07 pm



Viewing all articles
Browse latest Browse all 1576

Trending Articles