It is currently March 28th, 2024, 12:15 pm

Really long bang lines in the rainmeter section: what is the best approach?

Get help with creating, editing & fixing problems with skins
Post Reply
User avatar
Krainz
Posts: 186
Joined: May 27th, 2012, 5:16 am
Contact:

Really long bang lines in the rainmeter section: what is the best approach?

Post by Krainz »

I ended up editing the original Hotkey plugin .ini file in order to test enabling/disabling the hotkeys on Rainmeter focus/unfocus

I tried using disablemeasure, pausemeasure and togglepausemeasure to no avail

So the solution I came up with was a setoption that changed the hotkey to something obnoxious (like mouseclick+scroll lock) during unfocus.

This ends up generating some quite long bang lines in the Rainmeter section:

Code: Select all

[Rainmeter]
Update=100
BackgroundMode=2
SolidColor=#BackgroundColor#
OnFocusAction=[!SetOption Focus Text "Rainmeter focused"][!UpdateMeter *][!SetVariable FOCUS 1][!SetOption Green Hotkey DOWN][!SetOption Red Hotkey UP][!SetOption Blue Hotkey LEFT][!SetOption Black Hotkey RIGHT][!UpdateMeasureGroup Keys][!Redraw]
OnUnfocusAction=[!SetOption Focus Text "Rainmeter unfocused"][!UpdateMeter *][!SetVariable FOCUS 0][!SetOption Green Hotkey "MBUTTON SCROLLLOCK"][!SetOption Red Hotkey "MBUTTON SCROLLLOCK"][!SetOption Blue Hotkey "MBUTTON SCROLLLOCK"][!SetOption Black Hotkey "MBUTTON SCROLLLOCK"][!UpdateMeasureGroup Keys][!UpdateMeasure Green][!Redraw]

[Variables]
BackgroundColor=50,50,50,255
Key1=UP
Key2=DOWN
Key3=LEFT
Key4=RIGHT
Key5=MBUTTON SCROLLLOCK
FOCUS=1

[Red]
Measure=Plugin
Plugin=HotKey
Group=Keys
DynamicVariables=1
HotKey=UP
KeyUpAction=[!SetOption Background SolidColor "#BackgroundColor#"][!UpdateMeter Background][!Redraw]
KeyDownAction=[!SetOption Background SolidColor "255,0,0,255"][!UpdateMeter Background][!Redraw]

[Green]
Measure=Plugin
Plugin=HotKey
Group=Keys
HotKey=#Key2#
KeyDownAction=[!SetOption Background SolidColor "0,255,0,255"][!UpdateMeter Background][!Redraw]
KeyUpAction=[!SetOption Background SolidColor "#BackgroundColor#"][!UpdateMeter Background][!Redraw]

[Blue]
Measure=Plugin
Plugin=HotKey
HotKey=#Key3#
KeyDownAction=[!SetOption Background SolidColor "0,0,255,255"][!UpdateMeter Background][!Redraw]
KeyUpAction=[!SetOption Background SolidColor "#BackgroundColor#"][!UpdateMeter Background][!Redraw]

[Black]
Measure=Plugin
Plugin=HotKey
HotKey=#Key4#
KeyDownAction=[!SetOption Background SolidColor "0,0,0,255"][!UpdateMeter Background][!Redraw]
KeyUpAction=[!SetOption Background SolidColor "#BackgroundColor#"][!UpdateMeter Background][!Redraw]

[Style]
FontColor=255,255,255,255
X=18R
Y=5
DynamicVariables=1
AntiAlias=1

[Style1]
X=5
Y=2R
FontSize=8

[Focus]
Meter=String
MeterStyle=Style
Text=Rainmeter focused


[Background]
Meter=Image
SolidColor=#BackgroundColor#
X=0
Y=5R
W=200
H=90

[Key1Label]
Meter=String
MeterStyle=Style | Style1
Text=Red: #Key1#
Y=5r

[Key2Label]
Meter=String
MeterStyle=Style | Style1
Text=Green: #Key2#

[Key3Label]
Meter=String
MeterStyle=Style | Style1
Text=Blue: #Key3#

[Key4Label]
Meter=String
MeterStyle=Style | Style1
Text=Black: #Key4#

[Label5]
Meter=String
MeterStyle=Style | Style1
Text=FOCUS: #FOCUS#
What is the most efficient approach when it comes to cases like this? Is there no problem in having to use long bang lines in the Rainmeter section?
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am
Contact:

Re: Really long bang lines in the rainmeter section: what is the best approach?

Post by Mor3bane »

I see that approach quite often.

Whilst I dont do it usually, it seems just fine - as usually means; I am happy to utilise it when I find it useful, just not planning it that way to start with.

My example:

Code: Select all

[Rainmeter]
; Activates custom menu instead of default
;RightMouseUpAction=[!SkinCustomMenu]
ContextTitle="Cyan"
ContextAction=[!WriteKeyValue Variables MySepiaTint "120,220,220" "#@#RoundVariables.inc"][!WriteKeyValue Variables MyBackgroundImage "Cyan.png" "#@#RoundVariables.inc"][!WriteKeyValue Variables MyBackgroundRing "CyanRing.png" "#@#RoundVariables.inc"][!WriteKeyValue Variables MyLogoImage "Logo.png" "#@#RoundVariables.inc"][!WriteKeyValue Variables MyBackgroundSmall "CyanFrame.png" "#@#RoundVariables.inc"][!RefreshGroup Big][!RefreshGroup Small][!RefreshGroup drives][!RefreshGroup buttons]
ContextTitle2="Silver"
ContextAction2=[!WriteKeyValue Variables MySepiaTint "220,220,220" "#@#RoundVariables.inc"][!WriteKeyValue Variables MyBackgroundImage "Silver.png" "#@#RoundVariables.inc"][!WriteKeyValue Variables MyBackgroundRing "SilverRing.png" "#@#RoundVariables.inc"][!WriteKeyValue Variables MyLogoImage "Logo.png" "#@#RoundVariables.inc"][!WriteKeyValue Variables MyBackgroundSmall "SilverFrame.png" "#@#RoundVariables.inc"][!RefreshGroup Big][!RefreshGroup Small][!RefreshGroup drives][!RefreshGroup buttons]
ContextTitle3="Sepia"
ContextAction3=[!WriteKeyValue Variables MySepiaTint "242,212,165" "#@#RoundVariables.inc"][!WriteKeyValue Variables MyBackgroundImage "Sepia.png" "#@#RoundVariables.inc"][!WriteKeyValue Variables MyBackgroundRing "SepiaRing.png" "#@#RoundVariables.inc"][!WriteKeyValue Variables MyLogoImage "SepiaLogo.png" "#@#RoundVariables.inc"][!WriteKeyValue Variables MyBackgroundSmall "SepiaFrame.png" "#@#RoundVariables.inc"][!RefreshGroup Big][!RefreshGroup Small][!RefreshGroup drives][!RefreshGroup buttons]
ContextTitle4="Variables"
ContextAction4=["#@#RoundVariables.inc"]
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Really long bang lines in the rainmeter section: what is the best approach?

Post by balala »

Krainz wrote: December 20th, 2019, 4:21 am I tried using disablemeasure, pausemeasure and togglepausemeasure to no avail
A HotKey plugin measure can't be disabled with a !DisableMeasure bang, but it can with !CommandMeasure. I'd modify the OnFocusAction and OnUnfocusAction options of the [Rainmeter] section, changing with them only the value of the FOCUS variable:

Code: Select all

[Rainmeter]
...
OnFocusAction=[!SetVariable FOCUS "1"][!UpdateMeasure "MeasureFocus"]
OnUnfocusAction=[!SetVariable FOCUS "0"][!UpdateMeasure "MeasureFocus"]
I also would add a [MeasureFocus] measure, which disables / enables the HotKey plugin measures:

Code: Select all

[MeasureFocus]
Measure=Calc
Formula=#FOCUS#
IfCondition=(#CURRENTSECTION#>=1)
IfTrueAction=[!SetOption Focus Text "Rainmeter focused"][!CommandMeasure "Red" "Start"][!CommandMeasure "Green" "Start"][!CommandMeasure "Blue" "Start"][!CommandMeasure "Black" "Start"]
IfFalseAction=[!SetOption Focus Text "Rainmeter unfocused"][!CommandMeasure "Red" "Stop"][!CommandMeasure "Green" "Stop"][!CommandMeasure "Blue" "Stop"][!CommandMeasure "Black" "Stop"]
DynamicVariables=1
So no need to use !SetOption bangs.
User avatar
Krainz
Posts: 186
Joined: May 27th, 2012, 5:16 am
Contact:

Re: Really long bang lines in the rainmeter section: what is the best approach?

Post by Krainz »

balala wrote: December 20th, 2019, 12:48 pm A HotKey plugin measure can't be disabled with a !DisableMeasure bang, but it can with !CommandMeasure. I'd modify the OnFocusAction and OnUnfocusAction options of the [Rainmeter] section, changing with them only the value of the FOCUS variable:

Code: Select all

[Rainmeter]
...
OnFocusAction=[!SetVariable FOCUS "1"][!UpdateMeasure "MeasureFocus"]
OnUnfocusAction=[!SetVariable FOCUS "0"][!UpdateMeasure "MeasureFocus"]
I also would add a [MeasureFocus] measure, which disables / enables the HotKey plugin measures:

Code: Select all

[MeasureFocus]
Measure=Calc
Formula=#FOCUS#
IfCondition=(#CURRENTSECTION#>=1)
IfTrueAction=[!SetOption Focus Text "Rainmeter focused"][!CommandMeasure "Red" "Start"][!CommandMeasure "Green" "Start"][!CommandMeasure "Blue" "Start"][!CommandMeasure "Black" "Start"]
IfFalseAction=[!SetOption Focus Text "Rainmeter unfocused"][!CommandMeasure "Red" "Stop"][!CommandMeasure "Green" "Stop"][!CommandMeasure "Blue" "Stop"][!CommandMeasure "Black" "Stop"]
DynamicVariables=1
So no need to use !SetOption bangs.
That works, thank you!
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Really long bang lines in the rainmeter section: what is the best approach?

Post by balala »

Krainz wrote: December 20th, 2019, 5:06 pm That works, thank you!
Glad to help. :thumbup:
Post Reply