Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 1766

Help: Rainmeter Skins • Re: Calculating the text width

$
0
0
This is the proper way to do what you intend to do:

Basically the main problem is that InputText doesn't now what "#CRLF#" is, but it does know what \r\n is, however, rainmeter doesn't know what \r\n is lol. So there’s a miscommunication we need to solve, we need to use words both parts can understand.

Fortunately, both know what [\13][\10] is. The 3 things are the same thing but in a different language, all mean CRLF.

So basically what I do is to use substitute on the InputText plugin to replace \r\n with [\*13*][\*10*]. Then I use a Dummy variable to “waste” the $UserInput$ variable, then I use the string value of the measure (that contains the user input with the substitute included) to set and write the MyText variable.

Basically we are setting\writing the variable as Line1[\13][\10]Line2 instead of Line1#CRLF#Line2.

Now we have good communications:
asd.gif
PRESS CTRL+ENTER TO ENTER A NEW LINE*

Code:

[Rainmeter]Update=1000AccurateText=1DynamicWindowSize=1[Variables]FontSz=60MyText=Line1[\13][\10]Line2;==================================================================; #BASE#BASE#BASE#BASE;==================================================================;[Background]Meter=ShapeShape=Rectangle 0,0,([DisplayText:W]+15),([DisplayText:H]+10),10 | Fill Color 0,0,0,1 | StrokeWidth 2 | Stroke Color 0,0,0,1AntiAlias=1DynamicVariables=1MouseScrollUpAction=[!SetVariable FontSz "(Clamp((#FontSz#+1),50,200))"][!UpdateMeter *][!Redraw]MouseScrollDownAction=[!SetVariable FontSz "(Clamp((#FontSz#-1),50,200))"][!UpdateMeter *][!Redraw];===========================================================================[DisplayText]Meter=StringFontFace=ArialFontStyle=BOLDFontSize=[#FontSz]FontColor=255,255,255,255SolidColor=0,0,0,1InlineSetting=Shadow | 1 | 1 | 2 | 0,0,0,255X=8Y=5StringEffect=BorderFontEffectColor=0,0,0,255Text=[#MyText]DynamicVariables=1AntiAlias=1LeftMouseUpAction=[!CommandMeasure TextField "ExecuteBatch All"][TextField]Measure=PluginPlugin=InputTextX=([DisplayText:X])Y=([DisplayText:Y])W=([DisplayText:W])H=([DisplayText:H])FontSize=(#FontSz#/2)FontColor=255,255,255,255SolidColor=64,64,64,255AntiAlias=1FocusDismiss=1DefaultValue=[#MyText]RegExpSubstitute=1Substitute="\r\n":"[\*13*][\*10*]","\n":"[\*13*][\*10*]","\r":"[\*13*][\*10*]"Command1=[!SetVariable Dummy """$UserInput$"""][!SetVariable MyText """[TextField]"""][!WriteKeyValue Variables MyText "[TextField]"]Command2=[!UpdateMeter DisplayText][!UpdateMeter Background][!Redraw]OnDismissAction=[!UpdateMeter DisplayText][!UpdateMeter Background][!Redraw]DynamicVariables=1Hidden=1

Statistics: Posted by RicardoTM — Today, 3:43 am



Viewing all articles
Browse latest Browse all 1766

Trending Articles