OK first, I'm on my lunch break at work so I'll have to post full code later.
But, a quick description of the issue...
I wanted a simple clock which puts my work pc to sleep at end of the day. I copied from my other skins to create a clock with some mouse actions and four buttons to shutdown, restart, etc.
I tried adding an IfCondition to the time measure, which didn't work. So used an If Match instead which worked on my home pc. But seems to put the work pc to sleep every 5mins!
I used this code:
IfMatch=4.25 (to turn off at that time.)
IfMatchAction=#Sleep#
Thanks for any advice.
It is currently October 4th, 2023, 6:50 am
SOLVED - Problem with IfMatch
-
- Posts: 1139
- Joined: February 17th, 2011, 7:45 pm
- Location: a Galaxy S7 far far away
SOLVED - Problem with IfMatch
Last edited by sl23 on September 21st, 2022, 4:10 pm, edited 1 time in total.
- MuLab -
-
- Rainmeter Sage
- Posts: 15689
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Problem with IfMatch
An IfCondition=(#CURRENTSECTION#=4.25) option does work, but only if the Time measure where it is used has a proper format. For instance the following measure will execute the bangs set into the IfTrueAction option at the time given into the IfCondition option. Note that the time has a dot between the hour and minut, not a colon. This is needed to can handle the value returned by the measure as a number:
Code: Select all
[MeasureTime]
Measure=Time
Format=%H.%M
IfCondition=(#CURRENTSECTION#=4.25)
IfTrueAction=[BANGS TO EXECUTE WHEN CONDITON IS MET]
If this doesn1t help, please post a full code of your skin.
-
- Posts: 1139
- Joined: February 17th, 2011, 7:45 pm
- Location: a Galaxy S7 far far away
Re: Problem with IfMatch
Thanks balala. I did try your suggestion previously, but I'm using 12hr format - %#I:%M maybe that's why it didn't work for me?
Using 12 format just means it works twice a day doesn't it? But as pc won't be on in early hours that doesn't matter. Or does it work differently?
Using 12 format just means it works twice a day doesn't it? But as pc won't be on in early hours that doesn't matter. Or does it work differently?
- MuLab -
-
- Rainmeter Sage
- Posts: 15689
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Problem with IfMatch
I doubt it wouldn't work with the measure used on 12-hour format. It should work with it. If doesn't post the code please, when you get home.
If you don't use a %p on the Format option, there is nothing wrong with the 12-hour format. As you noticed in such a case the condition will be met twice a day and the action would be executed also twice a day, but if from these two cases one is out of your program and the computer is anyway shutdown at that moment, it's alright.
-
- Posts: 1139
- Joined: February 17th, 2011, 7:45 pm
- Location: a Galaxy S7 far far away
Re: Problem with IfMatch
I've given it a try but need to wait until the time approaches as I'm quite busy! 

- MuLab -
-
- Rainmeter Sage
- Posts: 15689
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Problem with IfMatch
Alright. Just please let me know if you succeeded when it's the time.
-
- Posts: 1139
- Joined: February 17th, 2011, 7:45 pm
- Location: a Galaxy S7 far far away
Re: Problem with IfMatch
Home now, and er... Nope, wasn't a success! Very odd! Any idea why? I did get this working in 2015,but deleted the skin as it wasn't required any longer. Something this simple shouldn't be this hard surely?! Lol
Out of curiosity, why is the IfMatch working like a timer instead of as it should?
Out of curiosity, why is the IfMatch working like a timer instead of as it should?
- MuLab -
-
- Rainmeter Sage
- Posts: 15689
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Problem with IfMatch
How could I? Post a code please, without it can't say anything.
What do you mean by IfMatch working like a timer? And how should it work?
-
- Posts: 1139
- Joined: February 17th, 2011, 7:45 pm
- Location: a Galaxy S7 far far away
Re: Problem with IfMatch
Ok so here's the full code:
Wow that was a quick reply! I was just posting the code and was stopped by your response 
Well, when I used the IfMatch it put the PC into Sleep mode every 4.25 mins, why would it do that? That is acting like a timer. It shouldn't do that. It should work like I am describing, set a time and the PC is put to Sleep.
EDIT:
I've just edited the code as I forgot to copy the skin code from the work PC before I left. Just in case you are in the midst of replying!
Code: Select all
[Rainmeter]
Update=1000
AccurateText=1
MouseActionCursor=0
BackgroundMode=2
SolidColor=255,255,255
MouseOverAction=[!ToggleMeterGroup Power] [!UpdateMeter *] [!Redraw]
MouseLeaveAction=[!ToggleMeterGroup Power] [!UpdateMeter *] [!Redraw]
RightMouseUpAction=[!TraMenu]
SkinWidth=150
SkinHeight=55
[Metadata]
Name=Clock + Shutdown
Author=sl23
Information=Clock with Shutdown.||
Version=2022.9.20
License=CC BY 3.0
[Variables]
Black=0,0,0
Trans=0,0,0,1
Shutdown.=250,150,150
Restart.=100,200,100
Sleep.=150,150,250
Lock.=235,170,100
Shutdown=shutdown.exe -s -t 00 -f
Restart=shutdown.exe -r -t 0
Sleep=rundll32.exe powrprof.dll,SetSuspendState
Lock=rundll32.exe user32.dll, LockWorkStation
Startup=shell:Startup
OFF=4.25.00
========================================
; Time
========================================
[mTime]
Measure=Time
Format=%#I:%M:%S
;IfMatch=#OFF#
;IfMatchAction=#Sleep#
IfCondition=(#CURRENTSECTION#=#OFF#)
IfTrueAction=#Sleep#
[Time]
Meter=String
MeasureName=mTime
FontFace=Trebuchet MS
StringStyle=Bold
StringAlign=CenterCenter
FontSize=25
FontColor=#Black#
;SolidColor=120,120,120
AntiAlias=1
Text=%1
LeftMouseUpAction=[!RefreshApp]
LeftMouseDoubleClickAction=#Startup#
MiddleMouseUpAction=[!Quit]
;ToolTipText="L - Refresh#CRLF#M - Exit"
X=75
Y=20
H=28
========================================
; SHUTDOWN
========================================
[sShut]
Shape=Rectangle 0,0,10,10,5 | Extend FillColor | StrokeWidth 2 | Extend StrokeAlpha
FillColor=Fill Color [#[#CURRENTSECTION]]
StrokeAlpha=Stroke Color #Trans#
MouseOverAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color #Black#"] [!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# StrokeAlpha ""] [!UpdateMeter *] [!Redraw]
DynamicVariables=1
ToolTipText=#CURRENTSECTION#
Group=Power
Hidden=1
X=15r
Y=r
[Shutdown.]
Meter=Shape
MeterStyle=sShut
LeftMouseUpAction=#Shutdown#
X=-26r
Y=18r
[Restart.]
Meter=Shape
MeterStyle=sShut
LeftMouseUpAction=#Restart#
[Sleep.]
Meter=Shape
MeterStyle=sShut
LeftMouseUpAction=#Sleep#
[Lock.]
Meter=Shape
MeterStyle=sShut
LeftMouseUpAction=#Lock#

Well, when I used the IfMatch it put the PC into Sleep mode every 4.25 mins, why would it do that? That is acting like a timer. It shouldn't do that. It should work like I am describing, set a time and the PC is put to Sleep.
EDIT:
I've just edited the code as I forgot to copy the skin code from the work PC before I left. Just in case you are in the midst of replying!
- MuLab -
-
- Rainmeter Sage
- Posts: 15689
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Problem with IfMatch
No, I were not...sl23 wrote: ↑September 20th, 2022, 4:14 pm Well, when I used the IfMatch it put the PC into Sleep mode every 4.25 mins, why would it do that? That is acting like a timer. It shouldn't do that. It should work like I am describing, set a time and the PC is put to Sleep.
EDIT:
I've just edited the code as I forgot to copy the skin code from the work PC before I left. Just in case you are in the midst of replying!
Your IfMatch solution does work here, and I don't get the action re-executed after every 4.25 minutes, so don't exactly what to say. For now I let it more than 20 minutes and still no re-execution. I don't see a reason for such an action, but how knows...
However, what could you try is to use IfCondition instead. For this replace the [mTime] measure as it follows:
Code: Select all
[mTime]
Measure=Time
Format=%#I.%M%S
IfCondition=(#CURRENTSECTION#=#OFF#)
IfTrueAction=#Sleep#
RegExpSubstitute=1
Substitute="^(\d{1,2})\.(\d{2})(\d{2})$":"\1:\2:\3"
When testing, make sure you don't forget to replace the OFF variable in the [Variables] section.
Please test this solution if you are interested and let me know if does work.