It is currently September 21st, 2019, 6:13 pm

Keyboard input

Discuss the use of Lua in Script measures.
dooderman10
Posts: 7
Joined: May 11th, 2017, 3:32 pm

Keyboard input

dooderman10 » May 11th, 2017, 3:34 pm

Is there any way that I can, let's say, press a rain meter button on my computer screen and have it press something like shift e? Thanks in advance.
User avatar
balala
Rainmeter Sage
Posts: 8634
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Keyboard input

balala » May 11th, 2017, 3:39 pm

dooderman10 wrote:Is there any way that I can, let's say, press a rain meter button on my computer screen and have it press something like shift e? Thanks in advance.
Not sure what you mean by "rain meter button", but for this kind of task, you don't even need a lua script (that1s why I'm not sure why have you posted this question into the Lua scripting section). The only thing you need is the HotKey plugin.
dooderman10
Posts: 7
Joined: May 11th, 2017, 3:32 pm

Re: Keyboard input

dooderman10 » May 11th, 2017, 7:24 pm

balala wrote:Not sure what you mean by "rain meter button", but for this kind of task, you don't even need a lua script (that1s why I'm not sure why have you posted this question into the Lua scripting section). The only thing you need is the HotKey plugin.
First, I meant a button that I created for my desktop with rainmeter, second, I got it working.
User avatar
balala
Rainmeter Sage
Posts: 8634
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Keyboard input

balala » May 11th, 2017, 8:21 pm

The following code will update the value of the Start variable, each time you're hitting the Shift + e keys (simultaneously):

Code: Select all

[Rainmeter]
Update=-1

[Variables]
E=0

[MeasureE]
Measure=Plugin
Plugin=HotKey
HotKey=SHIFT E
KeyDownAction=[!SetVariable E "(#E#+1)"][!UpdateMeasure "MeasureE"][!UpdateMeter "MeterE"][!Redraw]
DynamicVariables=1

[MeterE]
Meter=STRING
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=14
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=#E#
DynamicVariables=1
Note that this code will work ONLY if you install the HotKey plugin. As I also said in my last reply, you can download the plugin here. The easiest way for this is to download and install the HotKey_1.0.0.12.rmskin package, available in the post indicated above. This will install the skin and the appropriate version of the HotKey plugin. If you don't need the skin, you can simply remove it, the plugin will remain and will be usable. However, I'd recommend to take a look to the skin before you remove it, because you can see there how the plugin works.