It is currently May 21st, 2024, 4:52 pm

[Solved]Alarm for a specific time and date?

Get help with creating, editing & fixing problems with skins
User avatar
wiedzmawiedzma
Posts: 112
Joined: August 18th, 2012, 5:19 pm

[Solved]Alarm for a specific time and date?

Post by wiedzmawiedzma »

In yesterday's post, I got no answer to the question what to do to alert reacted with a specific time and date.
So I decided to ask again.
Why in the application Format = "% H% M" everything is OK!
And when I use Format = "% Y% m% d% H% M" can not get a response to a specific time and date?!! Please help again!
Here prepared rmskin only Format = "% Y% m% d% H% M" to make it easier to get some advice:

Code: Select all

[Rainmeter]
Author=WiedzmaWiedzma
Update=1000


--------------------------------------------------------------------------

;Metadata added by RainBrowser
;http://rainmeter.net/RainCMS/?q=Rainmeter101_AnatomyOfASkin

[Metadata]
Name=Alarm
Config=
Description=
Instructions=
Version=
Tags=
License=Creative Commons BY-NC-SA 3.0
Variant=
Preview=

;End of added Metadata

[Variables]
@include=#SKINSPATH#\Alarm2\UserVariables.inc



;----------------------------------------

[Background]
Meter=Image
ImageName=backAlarm.png
X=0
Y=2

[Title]
Meter=STRING
X=29
Y=5
fontColor=0,0,0,255
FontSize=8
FontFace=Segoe UI
StringEffect=Border
StringStyle=Bold
FontEffectColor=0,0,0,200
AntiAlias=1
Text="Alarm"
UpdateDivider=-1

[Title2]
Meter=STRING
X=29
Y=4
fontColor=7b7b7b
FontSize=8
FontFace=Segoe UI
StringStyle=Bold
AntiAlias=1
Text="Alarm"
UpdateDivider=-1

;----------------------------------------



[Al1]
Meter=Image
ImageName=1.png
x=145
y=5
ImageTint=#ACTIVECOLOR#
ToolTipText="Right click Reset"
MiddleMouseUpAction=!Execute [!WriteKeyValue Variables Hours ??  "#CURRENTPATH#UserVariables.inc"][!WriteKeyValue Variables Minutes ??  "#CURRENTPATH#UserVariables.inc"][!WriteKeyValue Variables Year ????  "#CURRENTPATH#UserVariables.inc"][!WriteKeyValue Variables Month ??  "#CURRENTPATH#UserVariables.inc"][!WriteKeyValue Variables Day ??  "#CURRENTPATH#UserVariables.inc"][!WriteKeyValue Variables ACTIVECOLOR 245,245,245,255  "#CURRENTPATH#UserVariables.inc"][!WriteKeyValue Variables Title ??????  "#CURRENTPATH#UserVariables.inc"][!Refresh #CURRENTCONFIG#]
DynamicVariables=1
Hidden=0


;----------------------------------------


[TextStyle]
FontFace=Arial
fontColor=7b7b7b
StringStyle=BOLD
FontSize=7
X = r
Y = -1r
AntiAlias=1

[TextStyle2]
FontFace=Arial
fontColor=0,0,0,255
StringEffect=Border
StringStyle=BOLD
FontEffectColor=0,0,0,200
FontSize=7
AntiAlias=1

; ----------------------------------




[MeasureExecuteAlarm] 
Measure=Time
Format="%Y%m%d%H%M"
IfEqualValue=#Year##Month##Day##Hours##Minutes#
IfEqualAction=!Execute [PLAYLOOP #ALARMSOUND#][!EnableMeasure ImageNumberCalc][!ShowMeter ImageMeter][!HideMeter IconAlarm][!ShowMeter DistAlarm]



; ----------------------------------



[IconAlarm]
Meter=Image
ImageName=IconAlarm.png
x=7
y=8
Hidden=0


[DistAlarm]
Meter=Image
ImageName=DistAlarm.png
x=7
y=8
ToolTipText="Turn off the alarm"
LeftMouseUpAction=!Execute [PLAYSTOP][!DisableMeasure ImageNumberCalc][!HideMeter ImageMeter][!HideMeter DistAlarm][!ShowMeter IconAlarm]
Hidden=1


[AlarmTextShadow]
Meter=String
MeterStyle=TextStyle2
X=5
Y=32
Text=Time :
ToolTipText="Alarm time"
MouseActionCursor=1




[AlarmText]
Meter=String
MeterStyle=TextStyle
Text=Time :
ToolTipText="Alarm time"
MouseActionCursor=1



[AlarmText2Shadow]
Meter=String
MeterStyle=TextStyle2
X=5
Y=46
Text=Date :
ToolTipText="Alarm date"
MouseActionCursor=1



[AlarmText2]
Meter=String
MeterStyle=TextStyle
Text=Date :
ToolTipText="Alarm date"
MouseActionCursor=1



[AlarmText3Shadow]
Meter=String
MeterStyle=TextStyle2
X=5
Y=60
Text=Title :
ToolTipText="Title alarm"
MouseActionCursor=1



[AlarmText3]
Meter=String
MeterStyle=TextStyle
Text=Title :
ToolTipText="Title alarm"
MouseActionCursor=1



[AlarmStatusCalc]
Measure=Calc
Formula="#Year##Month##Day##Hours##Minutes#"
IfEqualValue="????????????"
IfEqualAction=!Execute [!HideMeter AlarmStatus][!DisableMeasure AlarmStatusCalc]



[AlarmStatus]
Meter=Image
ImageName=0.png
Path=#CURRENTPATH#EnableAlarm
DynamicVariables=1
X=32
Y=22
Hidden=0



--------------------------------------
;Alarm 1
--------------------------------------

[TimeTextShadow]
Meter=String
MeterStyle=TextStyle2
StringAlign=Right
Text=#Hours#:#Minutes#
X=160
Y=32
ToolTipText="Enter the alarm time"
LeftMouseUpAction=!CommandMeasure "MeasureAlarmInput" "ExecuteBatch 1-7"
MouseActionCursor=1



[TimeText]
Meter=String
MeterStyle=TextStyle
StringAlign=Right
Text=#Hours#:#Minutes#
ToolTipText="Enter the alarm time"
LeftMouseUpAction=!CommandMeasure "MeasureAlarmInput" "ExecuteBatch 1-7"
MouseActionCursor=1



[DateText2Shadow]
Meter=String
MeterStyle=TextStyle2
StringAlign=Right
Text=#Year#-#Month#-#Day#
X=160
Y=46
ToolTipText="Enter the date!"
MouseActionCursor=1



[DateText]
Meter=String
MeterStyle=TextStyle
StringAlign=Right
Text=#Year#-#Month#-#Day#
ToolTipText="Enter the date!"
MouseActionCursor=1



[TitleTextShadow]
Meter=String
MeterStyle=TextStyle2
StringAlign=Right
Text=#Title#
X=160
Y=60
ToolTipText="Enter a title for alarm"




[TitleText]
Meter=String
MeterStyle=TextStyle
StringAlign=Right
Text=#Title#
ToolTipText="Enter a title for alarm"



[MeasureAlarmInput]
Measure=Plugin
Plugin=InputText.dll
SolidColor=50,50,50
FontColor=255,255,255,255
FontFace=Segoe UI
StringStyle=Bold
FontSize=8
X=52
Y=30
W=113
H=14
FocusDismiss=1
Command1=!WriteKeyValue Variables Hours $UserInput$ DefaultValue="(Hours) 00" "#CURRENTPATH#UserVariables.inc"
Command2=!WriteKeyValue Variables Minutes $UserInput$ DefaultValue="(Minutes) 00" "#CURRENTPATH#UserVariables.inc"]
Command3=!WriteKeyValue Variables Year $UserInput$ Y=43 DefaultValue="(Year) 0000" "#CURRENTPATH#UserVariables.inc"]
Command4=!WriteKeyValue Variables Month $UserInput$ Y=43 DefaultValue="(Month) 00" "#CURRENTPATH#UserVariables.inc"]
Command5=!WriteKeyValue Variables Day $UserInput$ Y=43 DefaultValue="(Day) 00" "#CURRENTPATH#UserVariables.inc"]
Command6=!Execute [!WriteKeyValue Variables Title $UserInput$ Y=60 DefaultValue="Title alarm!" "#CURRENTPATH#UserVariables.inc"][!WriteKeyValue Variables ACTIVECOLOR 48fd70 "#CURRENTPATH#UserVariables.inc"][!EnableMeasure AlarmStatusCalc][!ShowMeter AlarmStatus]
Command7=!Refresh #CURRENTCONFIG#



---------------------------------------


[Seperator]
Meter=Image
X=0
Y=0
W=165
H=1
SolidColor=0,0,0,76
UpdateDivider=-1


[Seperator2]
Meter=Image
X=0
Y=1r
W=165
H=1
SolidColor=255,255,255,13
UpdateDivider=-1

[Seperator3]
Meter=Image
X=0
Y=28
W=165
H=1
SolidColor=0,0,0,76
UpdateDivider=-1


[Seperator4]
Meter=Image
X=0
Y=1r
W=165
H=1
SolidColor=255,255,255,13
UpdateDivider=-1



[Seperator5]
Meter=Image
X=0
Y=74
W=165
H=1
SolidColor=0,0,0,76
UpdateDivider=-1


[Seperator6]
Meter=Image
X=0
Y=1r
W=165
H=1
SolidColor=255,255,255,13
UpdateDivider=-1

[ImageMeter]
Meter=Image
ImageName=[ImageNumberCalc].png
Path=#CURRENTPATH#EnableAlarm
DynamicVariables=1
X=32
Y=22
Hidden=1

[ImageNumberCalc]
Measure=Calc
Formula=Counter % 2
DynamicVariables=1
Disabled=1
You do not have the required permissions to view the files attached to this post.
Last edited by wiedzmawiedzma on September 6th, 2012, 2:30 am, edited 2 times in total.
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: Alarm for a specific time and date?

Post by MerlinTheRed »

Thanks for making the code a little easier to read. I'm a little puzzled by why it doesn't work, too. You have quite some incorrect syntax in there. Actually I'm amazed that the InputText measure even works as intended. The way you set the Y and DefaultValue looks like a very evil hack to me, especially putting them inside those !WriteKeyValue statements... I'm really amazed that works.

Code: Select all

Command1=!WriteKeyValue Variables Hours $UserInput$ DefaultValue="(Hours) 00" "#CURRENTPATH#UserVariables.inc"
Command2=!WriteKeyValue Variables Minutes $UserInput$ DefaultValue="(Minutes) 00" "#CURRENTPATH#UserVariables.inc"]
Command3=!WriteKeyValue Variables Year $UserInput$ Y=43 DefaultValue="(Year) 0000" "#CURRENTPATH#UserVariables.inc"]
Command4=!WriteKeyValue Variables Month $UserInput$ Y=43 DefaultValue="(Month) 00" "#CURRENTPATH#UserVariables.inc"]
Command5=!WriteKeyValue Variables Day $UserInput$ Y=43 DefaultValue="(Day) 00" "#CURRENTPATH#UserVariables.inc"]
Command6=!Execute [!WriteKeyValue Variables Title $UserInput$ Y=60 DefaultValue="Title alarm!" "#CURRENTPATH#UserVariables.inc"][!WriteKeyValue Variables ACTIVECOLOR 48fd70 "#CURRENTPATH#UserVariables.inc"][!EnableMeasure AlarmStatusCalc][!ShowMeter AlarmStatus]
Command7=!Refresh #CURRENTCONFIG#
The Y= and DefaultValue= statements are supposed to be used in !CommandMeasure bangs.

As for the comparison between the times, perhaps it's related to the difference between the number and string value of a time measure dependent of the usage context. I sometimes find this very confusing so an expert can probably tell you more here. One thing I'd definitely do is replace #Year##Month##Day##Hours##Minutes# with (#Year#)*100000000 + (#Month#)*1000000 + (#Day#)*10000 + (#Hours#)*100 + (#Minutes#). That way you won't need to worry about entering leading zeroes and you are guaranteed to get a number value.

Another thing is that you can't really compare strings with IfEqualAction (at least that's what I was told). Therefore, using IfEqualValue=??????? is not a good idea. I'd rather set those variables to -1 and use IfBelowValue=0, but then you'd have to change the display of the numbers depending on the value.
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
User avatar
wiedzmawiedzma
Posts: 112
Joined: August 18th, 2012, 5:19 pm

Re: Alarm for a specific time and date?

Post by wiedzmawiedzma »

I do not have the knowledge and skills to solve the problem yourself!
I do not know how to set these variables to -1
How do I have a problem with Formula Calc always looking for help on the forums. :oops:
User avatar
thatsIch
Posts: 446
Joined: August 7th, 2012, 9:18 pm

Re: Alarm for a specific time and date?

Post by thatsIch »

Ok a simple _minimal example_
shows the strange behaviour, maybe its a bug

Code: Select all

[Rainmeter]
Update=1000

[Variables]
Year = 2012
Month = 09
Day = 05
Hours = 22
Minutes = 37

[MeasureExecuteAlarm] 
Measure = Time
;Format = %H%M
Format = "%Y%m%d%H%M"
;IfEqualValue = #Hours##Minutes#
IfEqualValue = #Year##Month##Day##Hours##Minutes#
IfEqualAction = [!About]

[MaterTest]
Meter = String
MeasureName = MeasureExecuteAlarm
I tested this with both cases (just remove the ; and add it to the other lines)
Please enter your current time to test it yourself

Case 1: Test only Hour and Minutes:

Code: Select all

[Rainmeter]
Update=1000

[Variables]
Hours = 22
Minutes = 37

[MeasureExecuteAlarm] 
Measure = Time
Format = %H%M
IfEqualValue = #Hours##Minutes#
IfEqualAction = [!About]

[MaterTest]
Meter = String
MeasureName = MeasureExecuteAlarm
a) correct timing > About
b) incorrent timing > nothing

Case 2: Test Date:

Code: Select all

[Rainmeter]
Update=1000

[Variables]
Year = 2012
Month = 09
Day = 05
Hours = 22
Minutes = 37

[MeasureExecuteAlarm] 
Measure = Time
Format = "%Y%m%d%H%M"
IfEqualValue = #Year##Month##Day##Hours##Minutes#
IfEqualAction = [!About]

[MaterTest]
Meter = String
MeasureName = MeasureExecuteAlarm
a) incorrect time > about
b) correct time > about

so there is something wrong with the IfEqualValue. My Guess is: the number is just too big so testing something on equality you get round errors (look up how integers are handled especially if floating numbers are supported)

Solution
a) wait statement of a developer, they know their code better than any of us
b) use lua for a comparison
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: Alarm for a specific time and date?

Post by MerlinTheRed »

If that number is too big I'll eat a shoe ;)
wiedzmawiedzma wrote:I do not have the knowledge and skills to solve the problem yourself!
I do not know how to set these variables to -1
How do I have a problem with Formula Calc always looking for help on the forums. :oops:
Right now you are setting those variables to "??". Just replace it with "-1".
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
User avatar
wiedzmawiedzma
Posts: 112
Joined: August 18th, 2012, 5:19 pm

Re: Alarm for a specific time and date?

Post by wiedzmawiedzma »

Can you explain that to me an example of code:
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: Alarm for a specific time and date?

Post by MerlinTheRed »

For example, replace this:

Code: Select all

MiddleMouseUpAction=!Execute [!WriteKeyValue Variables Hours ??  "#CURRENTPATH#UserVariables.inc"][!WriteKeyValue Variables Minutes ??  "#CURRENTPATH#UserVariables.inc"][!WriteKeyValue Variables Year ????  "#CURRENTPATH#UserVariables.inc"][!WriteKeyValue Variables Month ??  "#CURRENTPATH#UserVariables.inc"][!WriteKeyValue Variables Day ??  "#CURRENTPATH#UserVariables.inc"][!WriteKeyValue Variables ACTIVECOLOR 245,245,245,255  "#CURRENTPATH#UserVariables.inc"][!WriteKeyValue Variables Title ??????  "#CURRENTPATH#UserVariables.inc"][!Refresh #CURRENTCONFIG#]
with this:

Code: Select all

MiddleMouseUpAction=!Execute [!WriteKeyValue Variables Hours -1  "#CURRENTPATH#UserVariables.inc"][!WriteKeyValue Variables Minutes -1  "#CURRENTPATH#UserVariables.inc"][!WriteKeyValue Variables Year -1  "#CURRENTPATH#UserVariables.inc"][!WriteKeyValue Variables Month -1  "#CURRENTPATH#UserVariables.inc"][!WriteKeyValue Variables Day -1 "#CURRENTPATH#UserVariables.inc"][!WriteKeyValue Variables ACTIVECOLOR 245,245,245,255  "#CURRENTPATH#UserVariables.inc"][!WriteKeyValue Variables Title ??????  "#CURRENTPATH#UserVariables.inc"][!Refresh #CURRENTCONFIG#]
And this:

Code: Select all

[AlarmStatusCalc]
Measure=Calc
Formula="#Year##Month##Day##Hours##Minutes#"
IfEqualValue="????????????"
IfEqualAction=!Execute [!HideMeter AlarmStatus][!DisableMeasure AlarmStatusCalc]
with this:

Code: Select all

[AlarmStatusCalc]
Measure=Calc
Formula="#Year##Month##Day##Hours##Minutes#"
IfBelowValue=0
IfBelowAction=!Execute [!HideMeter AlarmStatus][!DisableMeasure AlarmStatusCalc]
Of course that's not all you have to change, but I hope you get the idea.
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
User avatar
wiedzmawiedzma
Posts: 112
Joined: August 18th, 2012, 5:19 pm

Re: Alarm for a specific time and date?

Post by wiedzmawiedzma »

I do not understand my problem!
The problem is not [AlarmStatusCalc] but [MeasureExecuteAlarm] and the alarm for a specific time and date.
[AlarmStatusCalc] is only a png that appears when the alarm is set and disappears when it is reset.
User avatar
wiedzmawiedzma
Posts: 112
Joined: August 18th, 2012, 5:19 pm

Re: Alarm for a specific time and date?

Post by wiedzmawiedzma »

And I just checked the year, month and day used separately functioning properly and it turns out I did.
So I guess you can use this solution:

Code: Select all

[MeasureTime] 
Measure=Time
Format="%H%M"

[MeasureTime2] 
Measure=Time
Format="%Y"

[MeasureTime3] 
Measure=Time
Format="%m"

[MeasureTime4] 
Measure=Time
Format="%d"

[MeasureExecuteAlarm] 
Measure=Calc
Formula=//////////////////I need some help here////////////////////////
IfEqualValue=/////////////I need some help here////////////////////////
IfEqualAction=!Execute [PLAYLOOP #ALARMSOUND#][!EnableMeasure ImageNumberCalc][!ShowMeter ImageMeter][!HideMeter IconAlarm][!ShowMeter DistAlarm]
But to use the Formula Calc also need help!
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Alarm for a specific time and date?

Post by Kaelri »

There does indeed seem to be a bug related to large numbers. The IfValue only recognizes number values up to 2,147,483,648 (2^31); it will treat anything larger than this as equal. The "numbers" that you are trying to compare, such as "201209052200", are quite a bit bigger. So your approach cannot be used for now.

I would really recommend using Lua to simply compare the two dates. However, if you'd rather not go into learning Lua scripting, here's an alternative that should work:

Code: Select all

[Variables]
Year=2012
Month=09
Day=05
Hours=22
Minutes=00

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

[MeasureTime] 
Measure=Time
Format=%H%M

[MeasureDatesMatch]
Measure=Calc
Formula=MeasureDate=#Year##Month##Day#

[MeasureTimesMatch]
Measure=Calc
Formula=MeasureTime=#Hours##Minutes#

[MeasureExecuteAlarm]
Measure=Calc
Formula=MeasureDatesMatch * MeasureTimesMatch
IfEqualValue=1
IfEqualAction=[PLAYLOOP #ALARMSOUND#][!EnableMeasure ImageNumberCalc][!ShowMeter ImageMeter][!HideMeter IconAlarm][!ShowMeter DistAlarm]
MerlinTheRed wrote:The Y= and DefaultValue= statements are supposed to be used in !CommandMeasure bangs.
What wiedzmawiedzma did is actually legitimate for the InputText plugin. This is explained in the manual, although not very clearly, I admit.