It is currently November 21st, 2019, 10:18 am

InlineOptions for Seconds

Get help with installing and using Rainmeter.
User avatar
sl23
Posts: 408
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

InlineOptions for Seconds

sl23 » October 27th, 2019, 12:06 pm

I have used InlineOptions to reduce text size before, but I wondered if it were possible to reduce the size of the seconds value.

Currently I have the Time centralised in a skin which doesn't work if I use two separate meters for %H:%M and %S.

I've attempted to use the InlineOptions to achieve this but I'm either using the wrong syntax to get it working, or it doesn't work with anything other than plain text strings. Which, looking at the manual, appears to be the case.

Thanks for any advice
User avatar
jsmorley
Developer
Posts: 19743
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: InlineOptions for Seconds

jsmorley » October 27th, 2019, 12:11 pm

So far, your code looks perfect...
User avatar
balala
Rainmeter Sage
Posts: 9107
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: InlineOptions for Seconds

balala » October 27th, 2019, 12:59 pm

jsmorley wrote:
October 27th, 2019, 12:11 pm
So far, your code looks perfect...
Does it? Where?

sl23, a code would be great.
User avatar
jsmorley
Developer
Posts: 19743
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: InlineOptions for Seconds

jsmorley » October 27th, 2019, 1:03 pm

User avatar
jsmorley
Developer
Posts: 19743
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: InlineOptions for Seconds

jsmorley » October 27th, 2019, 1:21 pm

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

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

[MeterOne]
Meter=String
MeasureName=MeasureTime
FontSize=50
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
InlineSetting=Size | 20
InlinePattern=.+:.+(:.+)

1.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
sl23
Posts: 408
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: InlineOptions for Seconds

sl23 » October 27th, 2019, 5:52 pm

Damn, sorry, I was in a bit of a rush, forgot to add it :oops:

Thanks for the help. So, is that Regular Expressions you're using?

I just used this:

Code: Select all

[Time]
Meter=String
MeasureName=MeasureTime
MeterStyle=sText
FontSize=36
SolidColor=0,0,0,1
LeftMouseUpAction=[!ToggleMeasure MeasureChimeHour][!ToggleMeter ChimeSoundOFF][!Redraw]
;MiddleMouseUpAction=[%windir%\system32\control.exe timedate.cpl]
RightMouseUpAction=[!EnableMeasureGroup ALARM][!DisableMeasure MeasureChimeHour][!ShowMeterGroup ALARMSET][!HideMeter ChimeSoundOFF][!ShowMeter ChimeSoundALARM][!HideMeter SetClockBG][!Update]
InlineSetting=Size | 12
InlinePattern=%S
X=20
Y=10
Similar code worked for the String of another skin, so I assumed it would be the same for this. But as it's something constantly changing, I thought there would be need for a different approach. I just didn't know what.
User avatar
sl23
Posts: 408
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: InlineOptions for Seconds

sl23 » October 27th, 2019, 6:06 pm

Ok, so I tried the code you supplied, but just added the last line.
Initially it didn't work. So I removed the : from the code and only the second digit reduced in size. I tried adding a second + which had no effect. Then tried a second . which solved the problem.
So I got this:

Code: Select all

InlinePattern=.+:.+(..+)
As you can see... I have absolutely no idea what I'm doing :rofl: :rolmfao: :oops:

Thanks for your help :thumbup:
User avatar
jsmorley
Developer
Posts: 19743
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: InlineOptions for Seconds

jsmorley » October 27th, 2019, 6:38 pm

Yes, InlinePattern is using regular expression.

I'd need to see the measure that is returning the time for you to be of any more help.
User avatar
balala
Rainmeter Sage
Posts: 9107
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: InlineOptions for Seconds

balala » October 27th, 2019, 6:39 pm

EDIT: Sorry jsmorley, you probably know why...
sl23 wrote:
October 27th, 2019, 5:52 pm
So, is that Regular Expressions you're using?
Yep, it is regular expression. You can't use the %S expression on the InlinePattern option, because the String meter doesn't know that the appropriate Time measure has added the seconds, through the %S expression. That's why you have to tell which part of the shown string you want to format. In jsmorley's expression (InlinePattern=.+:.+(:.+)), .+ means one or more characters (here . represents any character, + means more of them). So, InlinePattern=.+:.+(:.+) means one or more characters (the first .+), followed by a colon, followed again by one or more characters (second .+) and finally followed by another colon and one or more characters. From these, the last colon and last one or more characters are captured, because only those are included into parenthesis. The InlineSetting applies to them.
If for instance you want to set only the last two digits, exclude the colon from the parentheses: InlinePattern=.+:.+:(.+).
Other approaches are also available: InlinePattern=\d{1,2}:\d{2}:(\d{2}). Here \d{1,2} means one or two digits, while \d{2} means exactly two digits.
Anyway, the %S expression won't be recognized by a String meter, because it belongs to the Time measure.
User avatar
sl23
Posts: 408
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: InlineOptions for Seconds

sl23 » October 27th, 2019, 7:19 pm

Ok, thanks, I sort of get the gist of your explanation, balala, but it doesn't ring true.
You say that .+ means one or more characters, but I had to add a second . in order for the meter to display both of the Seconds digits as FontSize=14. Why would that be?

Anyway, here's the full skin code (adapted from this), which is just a work in progress for enhancing an older skin I use that already has the Time centralised midscreen over the taskbar :jawdrop I know, I know, we had the discussion about placing skins over the win taskbar before, but I've never had an issue with it. Until I do, there it stays ;-)

Code: Select all

[Rainmeter]
Update=1000

[Metadata]
Name=Alarm Clock

;--------------------------------------------------
;--- VARIABLES & STYLES ---------------------------
;--------------------------------------------------

[Variables]
;SoundPath1=#@#sounds\chimehour.wav
;SoundPath2=#@#sounds\alarmclock.wav
AlarmHourSet=23
AlarmMinuteSet=0

[sText]
FontColor=128,255,0,100
FontFace=Corbel
FontSize=14
StringAlign=LEFT
StringStyle=Bold
AntiAlias=1

[Style2]
;LeftMouseUpAction=[!ShowMeterGroup ALARMSET][!HideMeter AlarmIconON][!Redraw]
LeftMouseUpAction=[!DisableMeasureGroup ALARM][!EnableMeasure mChimeHour][!HideMeter ChimeALARM][PlayStop "#SoundPath2#"][!Redraw]
;--------------------------------------------------
;--- MEASURES -------------------------------------
;--------------------------------------------------

;--- MEASURES CLOCK, CHIMESOUND & ALARM -----------

[mTime]
Measure=Time
Format=%#I:%M %S

[mMinMaxHourAlarm]
measure=calc
formula=#AlarmHourSet#
DynamicVariables=1
ifconditionmode=1
IfCondition=(#AlarmHourSet# < 0)
IfTrueAction=[!SetVariable AlarmHourSet "23"]
IfCondition2=(#AlarmHourSet# >= 24)
IfTrueAction2=[!SetVariable AlarmHourSet "0"]
RegExpSubstitute=1
Substitute="^(\d$)":"0\1"
Group=mALARM | ALARM

[mMinMaxMinuteAlarm]
measure=calc
formula=#AlarmMinuteSet#
DynamicVariables=1
ifconditionmode=1
IfCondition=(#AlarmMinuteSet# < 0)
IfTrueAction=[!SetVariable AlarmMinuteSet "55"]
IfCondition2=(#AlarmMinuteSet# >= 60)
IfTrueAction2=[!SetVariable AlarmMinuteSet "0"]
RegExpSubstitute=1
Substitute="^(\d$)":"0\1"
Group=mALARM | ALARM

[mDigitPrefixerAlarm]
Measure=calc
Formula=00
Dynamicvariables=1
IfCondition=(#AlarmHourSet# >= 0) && (#AlarmHourSet# <= 9)
IfTrueAction=[!SetOption HourAlarm Prefix "0"]
IfFalseAction=[!SetOption HourAlarm Prefix ""]
IfCondition2=(#AlarmMinuteSet# >= 0) && (#AlarmMinuteSet# <= 9)
IfTrueAction2=[!SetOption MinuteAlarm Prefix "0"]
IfFalseAction2=[!SetOption MinuteAlarm Prefix ""]
Group=mALARM | ALARM

[mHourAlarm]
Measure=Time
Format=%H
Group=ALARM

[mMinuteAlarm]
Measure=Time
Format=%M
Group=ALARM

[Alarm]
Measure=calc
Formula=0
DynamicVariables=1
IfCondition=(mHourAlarm = #AlarmHourSet#) && (mMinuteAlarm = #AlarmMinuteSet#)
IfTrueAction=[PlayLoop #@#sounds\alarmclock.wav][!Redraw]
Group=ALARM

;--------------------------------------------------
;--- BACKGROUND -----------------------------------
;--------------------------------------------------

[Bg]
Meter=Shape
MouseOverAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color 128,255,0,255"][!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color 128,255,0,100"][!UpdateMeter *][!Redraw]
Shape=Rectangle 1,1,180,70,5 | Fill Color 20,150,20,50 | StrokeWidth 2 | Extend StrokeAlpha
StrokeAlpha=Stroke Color 128,255,0,100
DynamicVariables=1

[sStroke]
MouseLeaveAction=[!SetOption #CURRENTSECTION# StrokeAlpha ""][!HideMeter #CURRENTSECTION#Name][!HideMeter #CURRENTSECTION#HiLite][!UpdateMeter *][!Redraw]
Shape=Rectangle 0,0,16,16,50 | Fill Color 20,150,20,50 | StrokeWidth 3 | Extend StrokeAlpha
StrokeAlpha=Stroke Color 128,255,0,0
DynamicVariables=1
X=10
Y=8

;--------------------------------------------------
;--- CLOCK, ALARM ---------------------------
;--------------------------------------------------

[Time]
Meter=String
MeasureName=mTime
MeterStyle=sText
FontSize=36
SolidColor=0,0,0,1
LeftMouseUpAction=[!ToggleMeasure mChimeHour][!ToggleMeter ChimeOFF][!Redraw]
;MiddleMouseUpAction=[%windir%\system32\control.exe timedate.cpl]
RightMouseUpAction=[!EnableMeasureGroup ALARM][!DisableMeasure mChimeHour][!ShowMeterGroup ALARMSET][!HideMeter ChimeOFF][!ShowMeter ChimeALARM][!Update]
InlineSetting=Size | 14
InlinePattern=.+:.+(..+)
X=5
Y=10

[sChime]
ImageAlpha=230
AntiAlias=1
ImageName=#@#images\Chime_off.png
Hidden=1
W=16
H=16

[mChimeHour]
Measure=Time
Format=%M
IfEqualValue=0
IfEqualAction=[Play "#@#sounds\chimehour.wav"]

[ChimeOFF]
Meter=Image
MeterStyle=sChime
X=R
Y=8
ToolTipText="ChimeSound is OFF"

[ChimeALARM]
Meter=Image
MeterStyle=sChime
X=r
Y=r
ToolTipText="Disabled in Alarm Mode"

======================================================
[AlarmSet]
Meter=Shape
MeterStyle=Bg | sStroke
X=55
Y=8
ToolTipText="L - Alarm Off"
LeftMouseUpAction=[!DisableMeasureGroup ALARM][!EnableMeasure mChimeHour][!HideMeter ChimeALARM][PlayStop "#SoundPath2#"][!Redraw]

[HourAlarm]
Meter=String
MeterStyle=sText | Style2
Text="#AlarmHourSet#:"
DynamicVariables=1
X=5R
Y=-4r
MouseScrollUpAction=[!SetVariable AlarmHourSet (#AlarmHourSet#+1)][!UpdateMeasureGroup mALARM][!UpdateMeter HourAlarm][!Redraw]
MouseScrollDownAction=[!SetVariable AlarmHourSet (#AlarmHourSet#-1)][!UpdateMeasureGroup mALARM][!UpdateMeter HourAlarm][!Redraw]

[MinuteAlarm]
Meter=String
MeterStyle=sText | Style2
Text="#AlarmMinuteSet#"
DynamicVariables=1
X=-4R
Y=r
MouseScrollUpAction=[!SetVariable AlarmMinuteSet (#AlarmMinuteSet#+1)][!UpdateMeasureGroup mALARM][!UpdateMeter MinuteAlarm][!Redraw]
MouseScrollDownAction=[!SetVariable AlarmMinuteSet (#AlarmMinuteSet#-1)][!UpdateMeasureGroup mALARM][!UpdateMeter MinuteAlarm][!Redraw]
I'm just trying to minimise it and understand how it all works together in order to extract what I wanted for my other skin.