It is currently December 3rd, 2022, 1:06 pm

HotKey plugin 1.0

Plugins and Addons popular with the Community
lmiol
Posts: 5
Joined: April 6th, 2022, 5:36 pm

Re: HotKey plugin 1.0

Post by lmiol »

balala wrote: November 12th, 2022, 10:04 pm Please double check your code and post it as you have it if it's working, because I assume there is something wrong in this post if the Plugin measure is working.
Yeah it wrong, but is works.
Probably part of code should be like this:

Code: Select all

[Rainmeter]
BackgroundMode=1
Update=-1
OnUpdateAction=[!Draggable 0][!ZPos -2][!SetWindowPosition "50%" "50%" "50%" "50%"]

[Variables]
KeyA=0x0D

[Launcher2]
Measure=Plugin
Plugin=HotKey
HotKey=#KeyA#
KeyUpAction=!Execute ["C:\Program Files (x86)\Steam\Steam.exe"]
User avatar
balala
Rainmeter Sage
Posts: 14758
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: HotKey plugin 1.0

Post by balala »

lmiol wrote: November 12th, 2022, 10:34 pm Yeah it wrong, but is works.
Probably part of code should be like this:

Code: Select all

[Rainmeter]
BackgroundMode=1
Update=-1
OnUpdateAction=[!Draggable 0][!ZPos -2][!SetWindowPosition "50%" "50%" "50%" "50%"]

[Variables]
KeyA=0x0D

[Launcher2]
Measure=Plugin
Plugin=HotKey
HotKey=#KeyA#
KeyUpAction=!Execute ["C:\Program Files (x86)\Steam\Steam.exe"]
Unfortunately, if the skin is active, the set action is executed whenever are you hitting the key, no matter if the skin has or has no focus. See below a solution.
The solution is to pause the HotKey plugin measure with a [!CommandMeasure "Launcher2" "Stop"] and unpause with a [!CommandMeasure "Launcher2" "Start"] bang. For instance, to enable the HotKey measure execution when you're hovering the mouse over the skin add a variable (let1s name it Action) to the [Variables] section:

Code: Select all

[Variables]
Action=0
Then add the following measure to your code:

Code: Select all

[MeasureHotKey]
Measure=Calc
Formula=#Action#
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!CommandMeasure "Launcher2" "Stop"]
IfFalseAction=[!CommandMeasure "Launcher2" "Start"]
DynamicVariables=1
And finally add the following two options to the [Rainmeter] section:

Code: Select all

[Rainmeter]
...
MouseOverAction=[!SetVariable Action "1"][!UpdateMeasure "MeasureHotKey"]
MouseLeaveAction=[!SetVariable Action "0"][!UpdateMeasure "MeasureHotKey"]
If the [Rainmeter] section already has MouseOverAction and MouseLeaveAction options, add the above bangs to the appropriate options, in addition to the existing ones.
With this solution, you get executed the set action ONLY when you're hovering the mouse over the skin.

Additional tip (once again): See the additional tip here. The !Execute bang should be omitted, no need for it, because it's deprecated. Accordingly the KeyUpAction option of the [Launcher2] measure, instead of KeyUpAction=!Execute ["C:\Program Files (x86)\Steam\Steam.exe"] should be simply KeyUpAction=["C:\Program Files (x86)\Steam\Steam.exe"].
lmiol
Posts: 5
Joined: April 6th, 2022, 5:36 pm

Re: HotKey plugin 1.0

Post by lmiol »

balala wrote: November 13th, 2022, 7:32 pm
Code works, as expected! Very Apretiated

But now i trying to get work #HotkeyA# (previous #Launcher2#) to all Green area instead of Red
Image

actually i am trying to get work #HotkeyA# of entire screen but only if taskbar is hided.
Rainmeter and this skin is intended as default shell instead Explorer. Hotkeys can enable/kill Explorer.
And if Explorer killed - then hotkeyA (button A of controller) should work at any area
Unfortunally this part

Code: Select all

["C:\Windows\SysWOW64\rundll32.exe" user32.dll,SetCursorPos 0,0"]
is forced solution to move cursor from center of screen.
Cursor at center of screen is a bug of Steam and it very annoying if you have 2 accounts
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 14758
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: HotKey plugin 1.0

Post by balala »

lmiol wrote: November 15th, 2022, 12:44 am actually i am trying to get work #HotkeyA# of entire screen but only if taskbar is hided.
Rainmeter and this skin is intended as default shell instead Explorer. Hotkeys can enable/kill Explorer.
And if Explorer killed - then hotkeyA (button A of controller) should work at any area
Unfortunally this part

Code: Select all

["C:\Windows\SysWOW64\rundll32.exe" user32.dll,SetCursorPos 0,0"]
is forced solution to move cursor from center of screen.
Cursor at center of screen is a bug of Steam and it very annoying if you have 2 accounts
I don't entirely follow, however for first please try adding the following Padding option to the [Button] meter: Padding=((#WORKAREAWIDTH#-233)/2),((#WORKAREAHEIGHT#-233)/2),((#WORKAREAWIDTH#-233)/2),((#WORKAREAHEIGHT#-233)/2). This is working if you set the width and height of the [Button] meter both to 233. You have the following options on the meter: W=233% and H=233%. Am not sure what you meant by using the percent character in these options, however they both have to be expressed in pixels, can't set them to percent. That's why I assumed both should be set to 233. If you want to change them, make sure you change the appropriate values in the above Padding option as well.