It is currently March 29th, 2024, 1:37 pm

Reminders skins created by me not working properly

Get help with creating, editing & fixing problems with skins
Tejas

Reminders skins created by me not working properly

Post by Tejas »

Hello friends, I am trying to make a skin to set reminders at a particular time entered by the User but it doesn't seem to work. It inputs values form the user perfectly and even displays the time entered. But at the time the alarm should ring it doesn't! Please help me find the mistakes. :-(

Here's the code :

Code: Select all

[Rainmeter]
Update=1000

[Variables]
AlarmTime=" "

[MeasureAlarm]
Measure=Time
Format=%#I:%M:%S
IfEqualValue=#AlarmTime#
IfEqualAction=[Play "#@#Sounds\bb.wav"]
DynamicVariables=1
Update=1

[MeterSet]
Meter=String
FontSize=12
FontColor=204,255,196,255
StringStyle=Bold
SolidColor=47,47,47,255
Padding=5,6,5,5
AntiAlias=1
Text=Add
LeftMouseUpAction=[!CommandMeasure MeasureInput "ExecuteBatch 1"]

[MeterInputLabel]
Meter=String
X=52
Y=0r
W=170
H=18
FontSize=12
FontColor=170,170,170,255
SolidColor=27,27,27,255
Padding=5,6,5,4
StringStyle=Italic
AntiAlias=1
Text=#AlarmTime#
DynamicVariables=1

[MeasureInput]
Measure=Plugin
Plugin=InputText
X=57
Y=4
W=171
H=20
FontSize=12
FontColor=255,255,255,255
SolidColor=47,47,47,255
AntiAlias=1
FocusDismiss=1
DefaultValue=#AlarmTime#
OnDismissAction=[!SetVariable CurrentInput ""][Play "#@#Sounds\Dismiss.wav"]
Command1=[!SetVariable AlarmTime "$UserInput$"][!UpdateMeter *][!Redraw]
BTW can you please tell me how to make the skin send a pop-up too.
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: Reminders skins created by me not working properly

Post by ikarus1969 »

Tejas wrote: January 8th, 2021, 5:54 am

Code: Select all

[MeasureAlarm]
Measure=Time
Format=%#I:%M:%S
IfEqualValue=#AlarmTime#
IfEqualAction=[Play "#@#Sounds\bb.wav"]
DynamicVariables=1
Update=1
BTW can you please tell me how to make the skin send a pop-up too.
You have to know that IfEqualValue (and IfAbove, IfBelow) only work with numerical values. In MeasureAlarm you have a string (current time in the format %I:%M:S).
To "compare" strings you can use regular-expressions, so please try:

Code: Select all

[MeasureAlarm]
Measure=Time
Format=%#I:%M:%S
IfMatch=#AlarmTime#
IfMatchAction=[Play "#@#Sounds\bb.wav"]
DynamicVariables=1
btw: i removed the Update=1 because there's no property on a meter like that. I you mean UpdateDivider=1 then it's also not necessary because that would be the default.

To make a popup, a basic approach is to define a meter that has the Hidden=1 property by default and become visible by sending the bang "ShowMeter" and become hidden by sending the bang "HideMeter". But please try that by yourself - you learn the most in "learning by doing".
User avatar
CodeCode
Posts: 1363
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Reminders skins created by me not working properly

Post by CodeCode »

From what I know of the Measure=Time function is that it is a string and not inherently numeric.

So try IfCondition instead.

Or look here for tips: https://forum.rainmeter.net/viewtopic.php?f=5&t=35748&p=180508&hilit=timer#p180508
Last edited by CodeCode on January 8th, 2021, 6:34 am, edited 1 time in total.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: Reminders skins created by me not working properly

Post by ikarus1969 »

CodeCode wrote: January 8th, 2021, 6:30 am From what I know of the Measure=Time function is that it is a string and not inherently numeric.

So try IfCondition instead.

Or look here for help: https://forum.rainmeter.net/viewtopic.php?f=5&t=35748&p=180508&hilit=timer#p180508
If the op enters a time that contains characters then IfCondition won't work (i think he enters characters too because he wants to compare with %I:%M:%S)
User avatar
CodeCode
Posts: 1363
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Reminders skins created by me not working properly

Post by CodeCode »

ikarus1969 wrote: January 8th, 2021, 6:32 am If the op enters a time that contains characters then IfCondition won't work (i think he enters characters too because he wants to compare with %I:%M:%S)
excellent.

i stand corrected.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
Tejas

Re: Reminders skins created by me not working properly

Post by Tejas »

Thanks a lot guys. I will try it as soon as I switch on my laptop next time (most probably today 4pm). Thanks again. :D
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Reminders skins created by me not working properly

Post by balala »

CodeCode wrote: January 8th, 2021, 6:30 am From what I know of the Measure=Time function is that it is a string and not inherently numeric.
A Time measure (as all measures in fact) is returning both: a numeric and a string value. In many cases these two values are the same (into a Calc measure for instance), but in case of a Time measure, these are completely different.
Let me explain: here is an extremely simple Time measure:

Code: Select all

[MeasureTime]
Measure=Time
Format=%#H:%M:%S
The string value retuned by this measure can be for instance 9:05:42 or 18:29:34 (or whatever). The appropriate numeric values are 9435517542 and 9435551374 accordingly (for 01/08/2021).
The string value can easily accessed with for instance a MeasureName=MeasureTime option into a String meter. To get the numeric value you have to use the [MeasureTime:TimeStamp] section variable.
Note that in the above case the [MeasureTime:] section variable is returning the numeric value as well, howvere using this variable can be tricky in some cases. For instance if you modify the Format option of the above measure to Format=%S (in this case the measure is returning the seconds only), the string value will be for instance 29, the value returnd by the [MeasureTime:] variable will be 29, while the value returnd by [MeasureTime:TimeStamp] will be for example 9435551374. Great difference.
CodeCode wrote: January 8th, 2021, 6:30 am So try IfCondition instead.
Neither the IfCondition can be used for string values. It also works ONLY on numeric checkings.
Tejas

Re: Reminders skins created by me not working properly

Post by Tejas »

Thanks for replying Balala but I don't understand what code should I use then? Can you please send the code for me.🙏🏻🙏🏻 :(
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Reminders skins created by me not working properly

Post by balala »

Tejas wrote: January 8th, 2021, 8:32 am Thanks for replying Balala but I don't understand what code should I use then? Can you please send the code for me.🙏🏻🙏🏻 :(
Alright, here it is. Firstly note that the Format=%#I:%M:%S time format in my opiniony at least doesn't make too much sense, a %p parameter would also be required I believe: Format=%#I:%M:%S %p. This parameter is adding the AM / PM to the time, which in case of using a 12 hours time measurement is needed, otherwise you can't make the difference between AM and PM.
Now as said, a Time measure has a string value (according to its Format option) and a numeric value, which can be accessed with the :TimeStamp parameter. Using the numeric format is much easier always because the comparasions are made much more easily. However if you're using an AlarmTime=12:00:00 pm variable for instance, you have to get the associated time stamp, which can be done with a newly added Time measure (the [MeasureAlarmTime] measure in the below code). But there is one more problem: you have to use the date besides the time as well, so I added a new Time measure ([MeasureDate]) which is returning the date and used its string value in the TimeStamp option of the [MeasureAlarmTime] measure (to get the time for the current day).
The updated code:

Code: Select all

[Rainmeter]
Update=1000

[Variables]
AlarmTime=""

[MeasureDate]
Measure=Time
Format=%Y.%m.%d

[MeasureAlarm]
Measure=Time
Format=%#I:%M:%S %p
IfCondition=([MeasureAlarm:TimeStamp]=[MeasureAlarmTime:TimeStamp])
IfTrueAction=[Play "#@#Sounds\bb.wav"]
DynamicVariables=1

[MeasureAlarmTime]
Measure=Time
TimeStamp=#AlarmTime# [MeasureDate]
TimeStampFormat=%#I:%M:%S %p %Y.%m.%d
DynamicVariables=1

[MeterSet]
Meter=String
FontSize=12
FontColor=204,255,196,255
StringStyle=Bold
SolidColor=47,47,47,255
Padding=5,6,5,5
AntiAlias=1
Text=Add
LeftMouseUpAction=[!CommandMeasure MeasureInput "ExecuteBatch 1"]

[MeterInputLabel]
Meter=String
X=52
Y=0r
W=170
H=18
FontSize=12
FontColor=170,170,170,255
SolidColor=27,27,27,255
Padding=5,6,5,4
StringStyle=Italic
AntiAlias=1
Text=#AlarmTime#
DynamicVariables=1

[MeasureInput]
Measure=Plugin
Plugin=InputText
X=57
Y=4
W=171
H=20
FontSize=12
FontColor=255,255,255,255
SolidColor=47,47,47,255
AntiAlias=1
FocusDismiss=1
DefaultValue=#AlarmTime#
OnDismissAction=[!SetVariable CurrentInput ""][Play "#@#Sounds\Dismiss.wav"]
Command1=[!SetVariable AlarmTime "$UserInput$"][!UpdateMeter *][!Redraw]
See that I replaced the IfEqualValue / IfEqualAction option pair of the original code with an IfCondition. This is a newer and much more powerful option and using it, I could verify the :TimeStamp parameter into the section variables.
Unfortunately I suppose the above code is quite complicated for a beginner. Give it a few tries to see how does it work. If any question arises, feel free to ask.
Tejas

Re: Reminders skins created by me not working properly

Post by Tejas »

Thanks Balala you're a gem! I will try to understand it. :D