This is a simple plugin that will run an action when a HotKey is pressed and/or released. This plugin is non-blocking, meaning it won't block other programs from using a HotKey. The skin does not need focus for the plugin to work.
Options include:
HotKey - Key or combination of keys (separated by a space) that perform an "Action". You can use letters, numbers, or pre-defined keywords.
KeyDownAction - Action to be performed when the hot key is pressed.
KeyUpAction - Action to be performed when the hot key is released. In some cases keys may need to be released in reverse order of being pressed. This is due to Windows removing the key up message from the queue before the plugin reads it.
ShowAllKeys - When 1, all keys pressed will be logged to the Rainmeter log. This can be useful when you aren't sure which hex code to use (especially for foreign keyboards). This also attempts to print the name of the key, but sometimes it gets it wrong. ie. The "Page Up" key will sometimes say "Num 9" - however, the hex code will be correct.
Notes:
You can represent any keyboard key by using its number equivilant (in either hex, octal, binary or base 10). See the list here. Example: HotKey=Shift 0x41 which translates to "SHIFT A"
This should work great on US keyboards. Non-US keyboards users might need to do some testing to see what physical key is mapped to a virtual-key. Use the list above to get any hex codes needed.
If SHIFT/CTRL/ALT is used with its L/R variations, the L/R variations will be ignored.
There are only 3 special toggle cases: CapsLock Status, ScrollLock Status, and NumLock Status. The number value of the plugin will be 1 when the toggle key is in the "on" state, and 0 when in the "off" state.
The number value of the plugin will always be 0 except in the special toggle cases when the toggle key state is "on".
The Fn on some laptop keyboards cannot be detected.
The mouse button's will not work by themselves, they require another non-mouse key to be used in combination with the mouse button.
On some keyboards, when NumLock is off, the keys on the Numeric Keypad will represent other keys (usually the navigation keys, like "Home").
On some keyboards, when SHIFT is used with a Numeric Keypad key, the HotKey may not work. Example: HotKey=Shift Num6 will not work because the plugin thinks the SHIFT and Numpad 6 need to be pressed, while the system thinks you pressed the Right Arrow key.
There may be cases where an elevated process will "block" the plugin from seeing a key being pressed.
Commands include:
Stop - This stops the plugin from performing any actions. This is similar to disabling the measure. Example: !CommandMeasure MeasureName Stop
Start - This tells the plugin to go ahead and perform the actions. Example: !CommandMeasure MeasureName Start
Toggle - If the plugin is stopped, it will start. If the plugin has started, it will stop. Example: !CommandMeasure MeasureName Toggle
Important: This plugin requires Rainmeter 3.0.2 (r2161) or higher to run. When packaging this plugin with your skin, make sure you set the "Minimum Rainmeter Version" to 3.0.2.2161 in the Skin Packager.
Below is a simple test skin I made to show how it works. At the top of the skin, there are 3 meters representing the 3 toggle keys. When the state of the toggle keys is "on", the meter text will be red - when the toggle keys are "off", it will be white. Below those meters will be 5 keys, that when pressed and released, will change the background of an image meter. There is also another test skin that shows how to use the "ShowAllKeys" option. (The plugin is included with the skin, or you can down the plugin here)
I have also included both 32-bit and 64-bit plugins in the @Resources\HotKey.dll folder.
-Brian
You do not have the required permissions to view the files attached to this post.
thanks a lot for this useful plugin.
Normaly everything works just perfect. I use it to ToggleConfig my SpotifySkin and to ToggleFade all active Skins.
But sometimes it just stops working and even a restart of Rainmeter doesn't help. I did close all other Programms and made a restart of Rainmeter - didn't help. The only thing that helps is a System restart.
Unfortunately I can't tell you why. There is no error Message in the Rainmeter Protocol.
My Settings:
3.2.0 beta r2302 64-bit (Jul 14 2014)
Windows 8.1 64-bit (build 9600)
It works well, even with single keys, though it gets congested rather easily so it's not ready for games or InputText replacement yet. One thing that may be desirable is the ability to deactivate hotkeys temporarily, especially while the skin is not focused. Disabled=1 currently does nothing.
killall-q wrote:It works well, even with single keys, though it gets congested rather easily so it's not ready for games or InputText replacement yet.
I would have no interest in making it possible to create a keylogger using this. If it was ever possible to replace InputText with this plugin, that would be a significant minus in my book. This needs to remain focused on "hotkeys" in the traditional sense of that, and not on capturing keystrokes. Personally, I would just disable the ability to use A-Za-z0-9 as a hotkey, without some accompanying modifier key like ALT/CTRL etc.
rm_lion wrote:But sometimes it just stops working and even a restart of Rainmeter doesn't help. I did close all other Programms and made a restart of Rainmeter - didn't help. The only thing that helps is a System restart.
Hi rm_lion, I just have a few questions for you.
What is the HotKey you are using?
Did you exit Rainmeter normally?
Are you using a non-US keyboard?
It is important to remember that all the keys in the hotkey should be released nearly at the same time.
killall-q wrote:It works well, even with single keys, though it gets congested rather easily so it's not ready for games or InputText replacement yet.
I am not sure what you mean by "Input Text replacement", as this isn't designed to replace that plugin at all.
killall-q wrote:One thing that may be desirable is the ability to deactivate hotkeys temporarily, especially while the skin is not focused. Disabled=1 currently does nothing.
Yeah, I was thinking about adding a command that temporarily disables the hotkey. Currently plugins have no knowledge when they are paused or disabled, so it would have to be done with a !CommandMeasure command. This is definitely on the radar, but not at the top yet.
but:
i do not like this as a plugin.
i think hotkeys shouldn't be skin-specific, but user-specific. i'd rather like this as a tab in the "Manage" window.
from the past:
in LiteStep the hotkey plugin of your choice (there were several) and it's settings were loaded in the main step.rc, not in the theme step.rc. well, of course you could do different, but this was considered bad manners.
maybe as a way to have extra, skin-specific hotkeys, these could be defined in the [Rainmeter] section of a skin.
killall-q wrote:Ah, I've been spoiled by WebParser. Is that the only plugin for which Disabled=1 works?
Technically speaking, even WebParser doesn't know it was paused/disabled. The reason it appears to obey Paused/Disabled is because WebParser's Update function uses an internal counter (ie. UpdateRate). So when the measure is disabled/paused, the WebParser Update function never gets called, thus never incrementing its internal counter.