It is currently March 28th, 2024, 11:33 pm

Working with InputText

Our most popular Tips and Tricks from the Rainmeter Team and others
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Working with InputText

Post by jsmorley »

rbriddickk84 wrote:Hi there!
Is there a method to limit the number of characters? I should say there is a 2 digit input field, and i don't want to let write in more than 99?
Or even trickier, if it is possible, then i liked to limit to 59 :) (minutes)
No, there is not, in the context of the input field itself. You can truncate or round the resulting value with a RegExpSubstitute or even an IfCondition / IfMatch of course, but when the user is entering in the field, there is no way to limit it.
User avatar
rbriddickk84
Rainmeter Sage
Posts: 276
Joined: February 17th, 2014, 12:39 pm
Location: Hungary

Re: Working with InputText

Post by rbriddickk84 »

:) Okay, thank you for the quick response!
Sean
Posts: 3
Joined: September 5th, 2014, 4:35 pm

Re: Working with InputText

Post by Sean »

I created a Lockscreen which has an input box where you can enter a password to disable the lockscreen. When the background is set to a low transparency, like 150 or less, I am able to see the Text that I enter, however when the backgrounds alpha channel is set to 255 like I want it to be it doesn't show the text that I enter which in this case are the * from the password. Any solutions?

Code: Select all

[Rainmeter]
Update=100
MouseAcionCursor=0
RightMouseDownAction=!Refresh
OnRefreshAction=!ZPos 2
RightMouseUpAction=[""]
RightMouseDoubleClickAction=[""]

[Variables]
AccessCode=
ValidCode=1234
DarkBlue=27,63,107,255
MediumBlue=92,135,209,255
LightBlue=207,224,255,255
LightRed=250,148,135,255
AlmostBlack=40,40,40,255
ImagesPath=C:\Users\Family\Pictures\Seans Pictures\

[Background]
Meter=Image
ImageName=sea.png
ImageTint=255,255,255,255
W=#SCREENAREAWIDTH#
H=#SCREENAREAHEIGHT#

;[Background]
;Meter=Image
;SolidColor=2,2,2,140
;W=#SCREENAREAWIDTH#
;H=#SCREENAREAHEIGHT#

;------Slideshow-----------


;[RandomImage]
;Measure=Plugin
;Plugin=Plugins\QuotePlugin.dll
;PathName=#ImagesPath#
;FileFilter=*.jpg;*.jpeg;*.gif;*.bmp;*.png
;Subfolders=1     ;Here you can toogle through the DISPLAY (or not) pictures from subfolders (if any)
;UpdateDivider=35    ;Slideshow time in seconds

;-----Date----------

[Date]
Measure=Time
Format=%A, %#d %B 

[mDate]
Meter=String
MeasureName=Date
X=0
Y=600
FontFace=Lato Hairline
StringAlign=Left
ClipString=1
AntiAlias=1
FontSize=40
FontColor=FFFFFF

:------Time--------

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

[mTime]
Meter=String
MeasureName=Time
;X=(#SCREENAREAWIDTH# / 2)
X=0
;Y=30
Y=500
FontFace=Lato Hairline
ClipString=1
AntiAlias=1
FontSize=70
FontColor=FFFFFF
;StringAlign=Center
;------------------

[OutlineBackground]
Meter=Image
ImageName=select.png
ImageTint=255,255,255,255
X=((#SCREENAREAWIDTH# / 2) - 150)
;X=550
Y=100
W=300
H=30
AntiAlias=1
LeftMouseDownAction=!PluginBang "MeasureInputCode ExecuteBatch 1"

;[Base]
;Meter=Image
;;ImageName=RectBack.png
;SolidColor=2,2,2,55
;X=((#SCREENAREAWIDTH# / 2) - 149)
;;X=551
;Y=100
;H=29
;W=298
;DynamicVariables=1
;AntiAlias=1
;LeftMouseDownAction=!RainmeterPluginBang "MeasureInputCode ExecuteBatch 1"

[MeasureInputCode]
Measure=Plugin
Plugin=InputText.dll
SolidColor=255,255,255,255
FontColor=0,0,0,255
StringAlign=Center
StringCase=Upper
FontFace=Lato Hairline
FontSize=28
AntiAlias=1
X=((#SCREENAREAWIDTH# / 2) - 150)
;X=550
Y=100
W=300
H=30
DefaultValue=""
Password=1
FocusDismiss=1
Command1=[!SetVariable AccessCode $UserInput$]

[AccessValid]
Measure=Calc
Formula=#AccessCode#
IfEqualValue=#ValidCode#
IfEqualAction=[!DeactivateConfig "MyLockScreen" "Lockscreen.ini"]
DynamicVariables=1

;[Image]
;MeasureName=RandomImage
;Meter=IMAGE
;X=((#SCREENAREAWIDTH# / 2) - 450)
;X=400
;Y=150
;W=900
;H=564
;Hidden=0
;PreserveAspectRatio=0
;;MouseOverAction=!Execute [!RainmeterShowMeterGroup Hover][!RainmeterRedraw]
;;MouseLeaveAction=!Execute [!RainmeterHideMeterGroup Hover][!RainmeterRedraw]
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Working with InputText

Post by jsmorley »

Sean,

The alpha (transparency) of the SolidColor setting on the measure is applied to the entire input entity, including the text. That is just the nature of the Windows control that is used.

If however, what you mean is that the input field is "hidden" by some background meter when that is solid, you are going to have to have the input field in "front" of the background meter by having it later in the skin .ini file.
Sean
Posts: 3
Joined: September 5th, 2014, 4:35 pm

Re: Working with InputText

Post by Sean »

No yeah I get what you mean, but for example if you look at the code i posted. If I remove the Background meter (comment it out) then I can see the text that I enter but when I add in the Background meter it covers over the inputted text
User avatar
StArL0rd84
Posts: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: Working with InputText

Post by StArL0rd84 »

jsmorley wrote:The alpha (transparency) of the SolidColor setting on the measure is applied to the entire input entity, including the text. That is just the nature of the Windows control that is used.
I would rather have the option of no solidColor at all.
Too bad the text and input fields alpha values are linked like this.

Forced to have SOME solidcolor or it's no text.
That's fine if the background meter is not transparent.
And because my background meter is transparent, the input field also has to be.

Did a workaround hiding the background, and building boxes around the input field with the same transparency as the
input field and the original background. pheeew man.

But now my text has the transparency of the background. :?

I guess that's just the nature of the beast, and were just out of luck till Microsoft decides to do things differently.
If they ever get a reason to do so.
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Working with InputText

Post by jsmorley »

StArL0rd84 wrote:I would rather have the option of no solidColor at all.
Too bad the text and input fields alpha values are linked like this.

Forced to have SOME solidcolor or it's no text.
That's fine if the background meter is not transparent.
And because my background meter is transparent, the input field also has to be.

Did a workaround hiding the background, and building boxes around the input field with the same transparency as the
input field and the original background. pheeew man.

But now my text has the transparency of the background. :?

I guess that's just the nature of the beast, and were just out of luck till Microsoft decides to do things differently.
If they ever get a reason to do so.
Yes, it is just not the nature of the beast in a Windows UI to have a transparent background on an input field.
User avatar
nemo081
Posts: 5
Joined: March 13th, 2017, 2:06 pm

Re: Working with InputText

Post by nemo081 »

Hello everyone, :welcome:
I'm trying to create a search with a single insertion of multiple sites.
I can not use the same input to multiple searches. :(
Can someone help me? ;-)

[Rainmeter]
Update=1000
Background=Background.png
BackgroundMode=3
BackgroundMargins=0,34,0,14

[Metadata]
Name=ACQUISTI
Author=nemo081
Information=Research on Amazon and ePRICE
License=Creative Commons BY-NC-SA 3.0
Version=1.0.0

[Variables]
fontName=ARIAL
textSize=9
colorBar=235,170,0,255
colorText=255,255,255,255

; ----------------------------------
; MEASURES return some kind of value
; ----------------------------------

[measureInput]
Measure=Plugin
Plugin=InputText.dll
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=10
Y=38
W=188
H=17
FocusDismiss=1
DefaultValue=""
Command1=["http://www.eprice.it/search.aspx?qs=$UserInput$"]
Command2=["http://www.amazon.it/s/url=search-alias%3Daps&field-keywords=$UserInput$"][!Redraw]
UpdateDivider=86400

; ----------------------------------
; STYLES are used to "centralize" options
; ----------------------------------

[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
; Meters using styleLeftText will be left-aligned.
StringCase=None
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
AntiAlias=1
ClipString=1

[styleSeperator]
SolidColor=255,255,255,15

; ----------------------------------
; METERS display images, text, bars, etc.
; ----------------------------------

[meterTitle]
Meter=String
MeterStyle=styleTitle
; Using MeterStyle=styleTitle will basically "copy" the
; contents of the [styleTitle] section here during runtime.
X=100
Y=12
W=190
H=18
Text=ePRICE

[meterSearch]
Meter=String
MeterStyle=styleLeftText
X=10
Y=40
W=190
H=14
Text=Cerca...
LeftMouseUpAction=[!CommandMeasure measureInput "ExecuteBatch ALL"]

[meterSeperator]
Meter=Image
MeterStyle=styleSeperator
X=10
Y=52
W=190
H=1
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Working with InputText

Post by jsmorley »

nemo081 wrote:Hello everyone, :welcome:
I'm trying to create a search with a single insertion of multiple sites.
I can not use the same input to multiple searches. :(
Can someone help me? ;-)

Code: Select all

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

[MeterInputLabel]
Meter=String
X=52
Y=0r
W=178
H=18
FontSize=12
FontColor=170,170,170,255
SolidColor=27,27,27,255
Padding=5,6,5,4
StringStyle=Italic
AntiAlias=1
Text=Search Google and Bing
LeftMouseUpAction=[!CommandMeasure MeasureInput "ExecuteBatch 1-3"]

[MeasureInput]
Measure=Plugin
Plugin=InputText
X=57
Y=4
W=178
H=20
FontSize=12
FontColor=170,170,170,255
SolidColor=47,47,47,255
AntiAlias=1
FocusDismiss=1
Command1=$UserInput$
Command2=["https://www.google.com/#q=[MeasureInput]"]
Command3=["https://www.bing.com/search?q=[MeasureInput]"]
The key here is that we get the user input one time in Command1. That will set the value of the measure, [MeasureInpuut] in this case, to that user input. Then in Command2 and Command3 we can use the value of the measure as a [SectionVariable] to go out and search on multiple sites.
User avatar
nemo081
Posts: 5
Joined: March 13th, 2017, 2:06 pm

Re: Working with InputText

Post by nemo081 »

I understood, thanks! everything works!

Section google:
Each button allows a search on the Google site search, G image, G news, G translate, G drive, G mail.

Section Purchasing:
a single entry to do research on Amazon, Eprice, and TrovaPrezzi.

PC Search section:
you search in Windows.

You like it?
You do not have the required permissions to view the files attached to this post.