InputText plugin


Plugin=InputText executes bangs with user input.

InputText works by defining a series of commands, which can be triggered by any "action" string (this includes mouse actions, conditional actions in a Calc measure, and other commands in an InputText measure, including the same measure). When triggered, a free-floating text input box is created to gather user input at the specified points in the command series. When all input has been submitted, the commands are carried out.

Additional help and examples for InputText can be found on the Rainmeter forums at Working with InputText.

Note: InputText is incompatible with skins set to Stay Topmost, or AlwaysOnTop=2, as the conflict between the input field, which requires "focus", and the constant attempts by the skin to stay on "top", in front of the input field, will not allow InputText to function correctly.

Options

Command1, Command2, ..., CommandN

Actions to execute when the plugin is triggered. The macro string $UserInput$ will be replaced by whatever the user types into it.

Command1=[!SetVariable SomeVar "$UserInput$"]

If the macro string $UserInput$ is repeated in a command series, multiple input boxes will be created in sequence. However, a single value input by the user can be used multiple times in different bangs in the same command series by using the string value of the InputText [MeasureName] as a section variable.

Command1=[!WriteKeyValue Variables SomeVar "$UserInput$"]
Command2=[!SetVariable SomeVar "[MeasureName]"]

In addition, a command can override the values of options in this measure when an option="value" pair is added as a parameter to a Command option.

Command1=[!SetVariable SomeVar "[MeasureName]"] FontColor="255,0,0,255"

Note: The macro string $UserInput$ and the section variable [MeasureName] must be enclosed in quotes in the Command option if the user input may contain spaces.

DefaultValue

Default text that will appear in the input box.

Password Default: 0

If set to 1, the input will be displayed as asterisks.

InputLimit Default: 0 unlimited

If defined, this will limit the number of characters allowed in the input field. Note that if a new line is entered with CTRL-Enter, this will be two characters, /r/n, toward the limit.

InputNumber Default: 0

If set to 1, only numeric input will be allowed. A single - can be the first character, and a single . can be at any position in the input.

X, Y

Position of the input box.

Note: Relative positioning with "r" and "R" is not supported.

W, H

Size of the input box.

Note: H should be large enough to accommodate the font.

SolidColor Default: 255,255,255,255

Color of the input field background.

Note: The alpha channel changes the opacity of the entire input box including the text, not just the background.

FontColor Default: 0,0,0

Color of the input text.

Note: Any alpha channel setting of FontColor is entirely ignored. The transparency of the input control is set by SolidColor, which will effect both the input box and text transparency.

FontFace

Family name of the input text font.

Note: Only fonts actually installed in Windows can be used.

FontSize

Size of the input text font.

StringStyle

Style of the input text. Valid values are Normal, Bold, Italic, and BoldItalic.

StringAlign Default: Left

Alignment of the input text. Valid values are Left, Right, Center.

Note: With right-aligned text, the cursor will move from left to right as text is typed. This is advised for skins using languages such as Arabic, which read right-to-left.

TopMost

Sets the Z-position of the input field. If set to 1 then the input field will stay on top of all windows while active. If set to 0 then other windows can be dragged in front of the input field while it is active. If not set at all (default) then the Z-position of the input field will follow the TopMost setting of the overall skin.

Note: This option should not be used when FocusDismiss=1 is set.

FocusDismiss Default: 1

If set to 1 (default), clicking anywhere other than on the input field will dismiss the input without taking action. If set to 0, the mouse is disabled until Enter or Escape is pressed.

OnDismissAction Default: 0

A bang or action that is executed when an active InputText field is dismissed without hitting Enter to execute the plugin commands.

Bangs

LeftMouseUpAction=[!CommandMeasure MeasureInputText "ExecuteBatch ALL"]
IfAboveAction=[!CommandMeasure MeasureInputText "ExecuteBatch 3"]
OnRefreshAction=[!CommandMeasure MeasureInputText "ExecuteBatch 1-4"]

The ExecuteBatch parameter supports the following syntax: "ExecuteBatch All / # / #-#"

  • All : All commands in the measure
  • # : Only a single command in the measure
  • #-# : A specific range of commands in the measure

Example

[Rainmeter]
Update=1000
DynamicWindowSize=1

[Variables]
FirstVar=!WriteKeyValue
SecondVar=!SetVariable
FontSize=14

[MeterBackground]
Meter=Image
SolidColor=1E3A69FF
W=250
H=105

[MeasureInput]
Measure=Plugin
Plugin=InputText
SolidColor=76A0E8FF
FontColor=255,255,255,255
FontFace=Seqoe UI
StringStyle=Italic
FontSize=#FontSize#
X=5
Y=5
H=25
W=240
DefaultValue="Change Me!"
Command1=!WriteKeyValue Variables FirstVar "$UserInput$" "#CURRENTPATH#InputText.inc"
Command2=!Refresh #CURRENTCONFIG#
Command3=!SetVariable SecondVar "$UserInput$" Y=40 DefaultValue="Change Me Too!"
Command4=["$UserInput$"] Y=75 DefaultValue="Text file path and name"

[MeterWriteKeyValue]
Meter=String
X=5
Y=5
FontSize=15
FontColor=255,255,255,255
AntiAlias=1
Text=#FirstVar#
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 1-2"

[MeterSetVariable]
Meter=String
X=5
Y=10R
FontSize=15
FontColor=255,255,255,255
AntiAlias=1
DynamicVariables=1
Text=#SecondVar#
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 3"

[MeterOpenEditor]
Meter=String
X=5
Y=10R
FontSize=15
FontColor=255,255,255,255
AntiAlias=1
DynamicVariables=1
Text=Open Text File
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 4"