death.crafter wrote: ↑August 19th, 2021, 4:42 pmGood to know that it helped
It helped for sure this time, but even though you did explain how it works, I'm not sure the OP learned something out of it in order to be able to do it on his own next time, whether it's in Lua or native Rainmeter code, considering it's his 5th post here and he's most likely still a beginner.
aetasoul wrote: ↑August 19th, 2021, 3:26 pm...also on another skin that I'm making to convert DEC to HEX, BIN, OCT and vice-versa.
For this skin, based on your own code (and yes, you were correct with your unanswered question of "There is something else to work with strings?", as that is the key; it's called
IfMatch - the
IfCondition equivalent, but for strings):
Code: Select all
[Variables]
fontName=Trebuchet MS
textSize=9
colorBar=235,170,0,255
colorText=255,255,255,205
searchValue=
Label1=Person1
Label2=Person2
Label3=Person3
Label4=Person4
Value1=Value1
Value2=Value2
Value3=Value3
Value4=Value4
[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
Background=#@#Background.png
BackgroundMode=3
BackgroundMargins=0,34,0,14
[Metadata]
Name=Numeri
Author=aetasoul
Information=Displays internal phones numbers.
License=Creative Commons BY-NC-SA 3.0
Version=1.0.0
---Measures---
[measureInput]
Measure=Plugin
Plugin=InputText
SolidColor=20,20,20,255
StringAlign=Left
StringCase=None
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
X=[meterSearch:X]
Y=[meterSearch:Y]
W=[meterSearch:W]
H=[meterSearch:H]
FocusDismiss=1
DefaultValue=""
Command1=[!SetVariable searchValue "$UserInput$"][!UpdateMeasure measureInput][!UpdateMeasureGroup ContactGroup][!UpdateMeterGroup ContactGroup][!Redraw]
UpdateDivider=-1
[measureLabel1]
Measure=String
String=#Label1#
UpdateDivider=-1
[measureValue1]
Measure=String
String=#Value1#
UpdateDivider=-1
[measureContact1]
Group=ContactGroup
Measure=String
String=#Label1##CRLF##Value1#
UpdateDivider=-1
IfMatch=(?siU)(?:^$|^.*[measureInput:EscapeRegExp].*$)
IfMatchAction=[!ShowMeterGroup Contact1Group]
IfNotMatchAction=[!HideMeterGroup Contact1Group]
IfMatchMode=1
DynamicVariables=1
[measureLabel2]
Measure=String
String=#Label2#
UpdateDivider=-1
[measureValue2]
Measure=String
String=#Value2#
UpdateDivider=-1
[measureContact2]
Group=ContactGroup
Measure=String
String=#Label2##CRLF##Value2#
UpdateDivider=-1
IfMatch=(?siU)(?:^$|^.*[measureInput:EscapeRegExp].*$)
IfMatchAction=[!ShowMeterGroup Contact2Group]
IfNotMatchAction=[!HideMeterGroup Contact2Group]
IfMatchMode=1
DynamicVariables=1
[measureLabel3]
Measure=String
String=#Label3#
UpdateDivider=-1
[measureValue3]
Measure=String
String=#Value3#
UpdateDivider=-1
[measureContact3]
Group=ContactGroup
Measure=String
String=#Label3##CRLF##Value3#
UpdateDivider=-1
IfMatch=(?siU)(?:^$|^.*[measureInput:EscapeRegExp].*$)
IfMatchAction=[!ShowMeterGroup Contact3Group]
IfNotMatchAction=[!HideMeterGroup Contact3Group]
IfMatchMode=1
DynamicVariables=1
[measureLabel4]
Measure=String
String=#Label4#
UpdateDivider=-1
[measureValue4]
Measure=String
String=#Value4#
UpdateDivider=-1
[measureContact4]
Group=ContactGroup
Measure=String
String=#Label4##CRLF##Value4#
UpdateDivider=-1
IfMatch=(?siU)(?:^$|^.*[measureInput:EscapeRegExp].*$)
IfMatchAction=[!ShowMeterGroup Contact4Group]
IfNotMatchAction=[!HideMeterGroup Contact4Group]
IfMatchMode=1
DynamicVariables=1
---Styles---
[styleTitle]
StringAlign=Center
StringCase=Upper
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,50
FontColor=#colorText#
FontFace=#fontName#
FontSize=10
AntiAlias=1
ClipString=1
[styleLeftText]
StringAlign=Left
StringCase=None
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
AntiAlias=1
Padding=0,2,0,2
ClipString=1
[styleRightText]
StringAlign=Right
StringCase=None
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
AntiAlias=1
Padding=0,2,0,2
ClipString=1
[styleBar]
BarColor=#colorBar#
BarOrientation=HORIZONTAL
SolidColor=255,255,255,15
---Meters---
[meterTitle]
Meter=String
MeterStyle=styleTitle
X=100
Y=12
W=190
H=18
Text=Numeri
[meterSearch]
Meter=String
MeterStyle=styleLeftText
X=10
Y=38
W=188
H=17
Text=Search...
LeftMouseUpAction=[!CommandMeasure measureInput "ExecuteBatch All"]
DynamicVariables=1
[meterLabel1]
Group=ContactGroup | Contact1Group
Meter=String
MeterStyle=styleLeftText
X=10
Y=60
MeasureName=measureLabel1
Text=%1
[meterValue1]
Group=ContactGroup | Contact1Group
Meter=String
MeterStyle=styleRightText
X=200
Y=0r
MeasureName=measureValue1
Text=%1
NumOfDecimals=1
AutoScale=1
[meterLabel2]
Group=ContactGroup | Contact2Group
Meter=String
MeterStyle=styleLeftText
X=10
Y=0R
MeasureName=measureLabel2
Text=%1
[meterValue2]
Group=ContactGroup | Contact2Group
Meter=String
MeterStyle=styleRightText
X=200
Y=0r
MeasureName=measureValue2
Text=%1
NumOfDecimals=1
AutoScale=1
[meterLabel3]
Group=ContactGroup | Contact3Group
Meter=String
MeterStyle=styleLeftText
X=10
Y=0R
MeasureName=measureLabel3
Text=%1
[meterValue3]
Group=ContactGroup | Contact3Group
Meter=String
MeterStyle=styleRightText
X=200
Y=0r
MeasureName=measureValue3
Text=%1
NumOfDecimals=1
AutoScale=1
[meterLabel4]
Group=ContactGroup | Contact4Group
Meter=String
MeterStyle=styleLeftText
X=10
Y=0R
MeasureName=measureLabel4
Text=%1
[meterValue4]
Group=ContactGroup | Contact4Group
Meter=String
MeterStyle=styleRightText
X=200
Y=0r
MeasureName=measureValue4
Text=%1
NumOfDecimals=1
AutoScale=1
And yes, this can have scrolling as well, with similar addition to death.crafter's implementation. This can search both contact "names" and "numbers", since it merges them in [measureContact...] measures, then uses IfMatch to test whether the contents of [measureInput] (
regular expression escaped using the
:EscapeRegExp parameter) is found in the previously merged string.
Here's a base converter I wrote some time ago, for DEC to any base up to base 36. Maybe you can use it as a "base" (see what I just did here?
) to add the reverse:
Code: Select all
[Variables]
Number=2744
Quotient=(#Number#)
Result=""
Base=20
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
---Measures---
[MeasureConvert]
Measure=Calc
Formula=(#Quotient#%#Base#)
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^10$":"A","^11$":"B","^12$":"C","^13$":"D","^14$":"E","^15$":"F","^16$":"G","^17$":"H","^18$":"I","^19$":"J","^20$":"K","^21$":"L","^22$":"M","^23$":"N","^24$":"O","^25$":"P","^26$":"Q","^27$":"R","^28$":"S","^29$":"T","^30$":"U","^31$":"V","^32$":"W","^33$":"X","^34$":"Y","^35$":"Z"
IfCondition=((#Quotient#)<>0)
IfTrueAction=[!SetVariable Result "[MeasureConvert]#Result#"][!SetVariable Quotient (Trunc(#Quotient#/#Base#))][!UpdateMeasure "MeasureConvert"]
IfConditionMode=1
DynamicVariables=1
---Meter---
[MeterConvert]
Meter=STRING
X=5
Y=5
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
FontSize=16
AntiAlias=1
Text="Number = #Number##CRLF#Base = #Base##CRLF#Result = #Result#"
DynamicVariables=1