It is currently April 24th, 2024, 4:22 pm

[Trick | Guide] Improvised skin console

Tips and Tricks from the Rainmeter Community
User avatar
deflore08
Posts: 209
Joined: July 12th, 2020, 7:47 am
Location: Ada, Garden City

[Trick | Guide] Improvised skin console

Post by deflore08 »

Hey there!

Sometimes i feel broken when i have to edit some things in my code to see a changes, for example: to stop some counters on a flight, to change variables and so on. I do not want to make this changes permanently, so i began to play with Input plugin to make an improvised console for my skin.

The idea is next: we catch input and use it as a Bang, then see what happens. So, the following code do this things:

Code: Select all

[Variables]

; --- #Command_Trigger# triggers the conditional measure; #Command_Input# is your input

 Command_Trigger                  = 0
 Command_Input                    = 

; --- Input Measure. 1st command writes and sets the #Command_Input# variable then set #Command_Trigger# to 1

[sensor.COMMAND_INPUT]
 Measure                          = PLUGIN
 Plugin                           = InputText
 MeterStyle                       = any.style
 X                                = 0
 Y                                = 0
 W                                = 150
 H                                = 15
 SolidColor                       = 0,0,0,255
 FontColor                        = 255,255,255,255
 DefaultValue                     = #Command_Input#
 FocusDismiss                     = 1
 DynamicVariables                 = 1

 Command1                         = [!WriteKeyValue Variables Command_Input " $UserInput$" "filetowrite.inc"][!SetVariable Command_Input [sensor.COMMAND_INPUT]][!UpdateMeter text.dynamic.COMMAND_INPUT][!Redraw]
 Command2                         = [!SetVariable Command_Trigger "1"][!UpdateMeasure formula.COMMAND_INPUT]

; --- Conditional measure. When #Comman_Trigger# = 1 it executes your input as a Bang. Variable is nested so you do not need to write [!Refresh] - just "refresh"

[formula.COMMAND_INPUT]
 Measure                          = CALC
 Formula                          = #Command_Trigger#
 DynamicVariables                 = 1
 
     ifCondition                  = #CURRENTSECTION# = 1
          ifTrueAction            = [!#Command_Input#] [!Delay 200][!SetVariable Command_Trigger "0"][!UpdateMeasure #CURRENTSECTION#]
Thus we can just type refresh instead [!Refresh] to get our skin refreshed. This little code part made my life much easier and skin manage as more flexible.

Of course, it's a quick sketch and i believe there is a much ways to make it better, faster, shorter, and more beautiful, so i will extend this post if you will suggest more options and approaches. So let the games begin. :)
Image * Image * Image * Image