LightWeight HotKey is a keyboard shortcut utility for Windows.

It offers a subset of AutoHotkey's features and can be configured through a graphical interface.

Why It Was Built

I used AutoHotkey for several shortcuts. I wanted to add shortcuts and change their behavior without editing scripts each time.

Antivirus software also sometimes flagged executables I compiled with Ahk2Exe.

Features

  • Activate windows
    • Find windows by title, class name, or process name.
    • Match strings or regular expressions.
      • Use WinSpy to inspect windows.
  • Launch apps using the current, high, medium, or low integrity level.
  • Resize and move windows.
  • Move the pointer relative to a target window.
  • Send keyboard and mouse input.
  • Move the pointer to a matched image
    • Image matching requirements
      • The screen and reference image must use the same DPI.
      • The screen region must be at least 90% similar to the reference image.
    • The first OpenCV load may take a moment.
  • Paste text of any length using the clipboard.
  • Chain rules to run them together.
  • Run rules based on display scaling.
  • Copy items from a CListCtrl (SysListView32) control in another process
    • Items longer than 260 characters cannot be copied.
    • Owner-data lists are unsupported.
  • Click, double-click, or move the pointer to icons in the Windows notification area (Shell_TrayWnd).
    • Hidden icons are currently unsupported.
    • If Click or Double Click has no effect, try Emulate Click or Emulate Double Click.

Comparison with AutoHotkey

  LightWeight HotKey AutoHotKey
Setup difficulty Moderate Advanced (requires scripting)
Range of features X (selected shortcut actions only) O
GUI O X
Regular expressions O O
Choose a target integrity level O X
Antivirus detection X O
Schedule at Windows startup O X
Implementation Hook Hook
DLL Injection X X

Supported Conditions

Name Description
RCT_AlwaysAlways run
RCT_ActiveWindow_FullScreenThe active window is full screen
RCT_ActiveWindow_TitleMatchThe active window title matches exactly
RCT_ActiveWindow_TitleBeginThe active window title starts with the given text
RCT_ActiveWindow_TitleEndThe active window title ends with the given text
RCT_ActiveWindow_TitleContainsThe active window title contains the given text
RCT_ActiveWindow_TitleRegexMatchThe active window title matches a regular expression
RCT_ActiveWindow_ClassNameMatchThe active window class name matches exactly
RCT_ActiveWindow_ClassNameBeginThe active window class name starts with the given text
RCT_ActiveWindow_ClassNameEndThe active window class name ends with the given text
RCT_ActiveWindow_ClassNameContainsThe active window class name contains the given text
RCT_ActiveWindow_ClassNameRegexMatchThe active window class name matches a regular expression
RCT_ActiveWindow_ProcessNameMatchThe active window process name matches exactly
RCT_ActiveWindow_ProcessNameBeginThe active window process name starts with the given text
RCT_ActiveWindow_ProcessNameEndThe active window process name ends with the given text
RCT_ActiveWindow_ProcessNameContainsThe active window process name contains the given text
RCT_ActiveWindow_ProcessNameRegexMatchThe active window process name matches a regular expression
RCT_ActiveWindow_ProcessPathMatchThe active window process path matches exactly
RCT_MouseCursorChildWindow_TitleMatchThe child window under the pointer title matches exactly
RCT_MouseCursorChildWindow_TitleBeginThe child window under the pointer title starts with the given text
RCT_MouseCursorChildWindow_TitleEndThe child window under the pointer title ends with the given text
RCT_MouseCursorChildWindow_TitleContainsThe child window under the pointer title contains the given text
RCT_MouseCursorChildWindow_TitleRegexMatchThe child window under the pointer title matches a regular expression
RCT_MouseCursorChildWindow_ClassNameMatchThe child window under the pointer class name matches exactly
RCT_MouseCursorChildWindow_ClassNameBeginThe child window under the pointer class name starts with the given text
RCT_MouseCursorChildWindow_ClassNameEndThe child window under the pointer class name ends with the given text
RCT_MouseCursorChildWindow_ClassNameContainsThe child window under the pointer class name contains the given text
RCT_MouseCursorChildWindow_ClassNameRegexMatchThe child window under the pointer class name matches a regular expression
RCT_MouseCursorChildWindow_ProcessNameMatchThe child window under the pointer process name matches exactly
RCT_MouseCursorChildWindow_ProcessNameBeginThe child window under the pointer process name starts with the given text
RCT_MouseCursorChildWindow_ProcessNameEndThe child window under the pointer process name ends with the given text
RCT_MouseCursorChildWindow_ProcessNameContainsThe child window under the pointer process name contains the given text
RCT_MouseCursorChildWindow_ProcessNameRegexMatchThe child window under the pointer process name matches a regular expression
RCT_MouseCursorChildWindow_ProcessPathMatchThe child window under the pointer process path matches exactly
RCT_FindWindow_TitleMatchThe target window title matches exactly
RCT_FindWindow_TitleBeginThe target window title starts with the given text
RCT_FindWindow_TitleEndThe target window title ends with the given text
RCT_FindWindow_TitleContainsThe target window title contains the given text
RCT_FindWindow_TitleRegexMatchThe target window title matches a regular expression
RCT_FindWindow_ClassNameMatchThe target window class name matches exactly
RCT_FindWindow_ClassNameBeginThe target window class name starts with the given text
RCT_FindWindow_ClassNameEndThe target window class name ends with the given text
RCT_FindWindow_ClassNameContainsThe target window class name contains the given text
RCT_FindWindow_ClassNameRegexMatchThe target window class name matches a regular expression
RCT_FindWindow_ProcessNameMatchThe target window process name matches exactly
RCT_FindWindow_ProcessNameBeginThe target window process name starts with the given text
RCT_FindWindow_ProcessNameEndThe target window process name ends with the given text
RCT_FindWindow_ProcessNameContainsThe target window process name contains the given text
RCT_FindWindow_ProcessNameRegexMatchThe target window process name matches a regular expression
RCT_FindWindow_ProcessPathMatchThe target window process path matches exactly
RCT_Global_FindWindow_TitleMatchThe window anywhere on the desktop title matches exactly
RCT_Global_FindWindow_TitleBeginThe window anywhere on the desktop title starts with the given text
RCT_Global_FindWindow_TitleEndThe window anywhere on the desktop title ends with the given text
RCT_Global_FindWindow_TitleContainsThe window anywhere on the desktop title contains the given text
RCT_Global_FindWindow_TitleRegexMatchThe window anywhere on the desktop title matches a regular expression
RCT_Global_FindWindow_ClassNameMatchThe window anywhere on the desktop class name matches exactly
RCT_Global_FindWindow_ClassNameBeginThe window anywhere on the desktop class name starts with the given text
RCT_Global_FindWindow_ClassNameEndThe window anywhere on the desktop class name ends with the given text
RCT_Global_FindWindow_ClassNameContainsThe window anywhere on the desktop class name contains the given text
RCT_Global_FindWindow_ClassNameRegexMatchThe window anywhere on the desktop class name matches a regular expression
RCT_Global_FindWindow_ProcessNameMatchThe window anywhere on the desktop process name matches exactly
RCT_Global_FindWindow_ProcessNameBeginThe window anywhere on the desktop process name starts with the given text
RCT_Global_FindWindow_ProcessNameEndThe window anywhere on the desktop process name ends with the given text
RCT_Global_FindWindow_ProcessNameContainsThe window anywhere on the desktop process name contains the given text
RCT_Global_FindWindow_ProcessNameRegexMatchThe window anywhere on the desktop process name matches a regular expression
RCT_Global_FindWindow_ProcessPathMatchThe window anywhere on the desktop process path matches exactly
RCT_IME_EnglishThe IME is in English mode. Use the Negative option to invert this condition.
RCT_TrayIconProcessNameMatchForWin10OrLowerFind a notification area icon by process name (Windows 10 or earlier)
RCT_TrayIconTitleMatchMatch the notification area icon text (Windows 11)
RCT_TrayIconTitleRegexMatchMatch the notification area icon text using a regular expression (Windows 11)
RCT_Desktop_ImageMatchMatch an image on the desktop
RCT_ActiveWindow_ImageMatchMatch an image in the active window
RCT_IsScale_100_Percent_Ratio_96DPI is 100% (Ratio: 96)
RCT_IsScale_125_Percent_Ratio_120DPI is 125% (Ratio: 120)
RCT_IsScale_150_Percent_Ratio_144DPI is 150% (Ratio: 144)
RCT_IsScale_175_Percent_Ratio_168DPI is 175% (Ratio: 168)
RCT_IsScale_200_Percent_Ratio_192DPI is 200% (Ratio: 192)

Supported Actions

Name Description
RET_ActivateActivate the target window
RET_Activate_Next_WindowActivate the next window in Z-order
RET_Activate_Last_WindowActivate the previous window in Z-order
RET_Activate_Same_ProcessName_Next_WindowActivate the next window with the same process name
RET_Activate_Same_ProcessName_Last_WindowActivate the last window with the same process name
RET_Activate_Same_ProcessPath_Next_WindowActivate the next window with the same executable path
RET_Activate_Same_ProcessPath_Last_WindowActivate the last window with the same executable path
RET_Activate_Or_Same_ProcessName_Next_WindowActivate the target window or, if it is already active, switch to the next window with the same process name
RET_Activate_Or_Same_ProcessName_Last_WindowActivate the target window or, if it is already active, switch to the last window with the same process name
RET_Activate_Or_Same_ProcessPath_Next_WindowActivate the target window or, if it is already active, switch to the next window with the same executable path
RET_Activate_Or_Same_ProcessPath_Last_WindowActivate the target window or, if it is already active, switch to the last window with the same executable path
RET_Activate_All_Same_ProcessName_Window_TileTile all windows with the same process name
RET_Activate_All_Same_Class_Window_TileTile all windows with the same window class
RET_Activate_All_Same_ProcessId_Class_Window_TileTile all windows with the same process ID and window class
RET_Show_All_Same_ProcessNameShow all windows with the same process name
RET_Show_All_Same_ClassShow all windows with the same window class
RET_Show_All_Same_ProcessIdShow all windows with the same process ID
RET_ExecuteAppLaunch an app
RET_ExecuteApp_HighIntegrityLaunch an app at high integrity
RET_ExecuteApp_MediumIntegrityLaunch an app at medium integrity
RET_ExecuteApp_LowIntegrityLaunch an app at low integrity
RET_Size_FixedResize the window to fixed dimensions
RET_Size_PercentResize the window by percentage
RET_SizeUpEnlarge the window
RET_SizeDownShrink the window
RET_MoveMove the window to a fixed position
RET_MoveToMove the window by an offset
RET_MoveToCurrentMonitor_LeftMove the window to the left of the current monitor
RET_MoveToCurrentMonitor_RightMove the window to the right of the current monitor
RET_MoveToCurrentMonitor_TopMove the window to the top of the current monitor
RET_MoveToCurrentMonitor_BottomMove the window to the bottom of the current monitor
RET_MoveToCurrentMonitor_LeftTopMove the window to the left top of the current monitor
RET_MoveToCurrentMonitor_LeftBottomMove the window to the left bottom of the current monitor
RET_MoveToCurrentMonitor_RightTopMove the window to the right top of the current monitor
RET_MoveToCurrentMonitor_RightBottomMove the window to the right bottom of the current monitor
RET_MoveToCurrentMonitor_CenterMove the window to the center of the current monitor
RET_MoveToCurrentMonitor_Horizontal_CenterMove the window to the horizontal center of the current monitor
RET_MoveToCurrentMonitor_Vertical_CenterMove the window to the vertical center of the current monitor
RET_MoveToCurrentMonitor_Left_PercentMove the window to the left of the current monitor with a percentage offset
RET_MoveToCurrentMonitor_Top_PercentMove the window to the top of the current monitor with a percentage offset
RET_MoveToCurrentMonitor_Right_PercentMove the window to the right of the current monitor with a percentage offset
RET_MoveToCurrentMonitor_Bottom_PercentMove the window to the bottom of the current monitor with a percentage offset
RET_MoveToCurrentMonitor_LeftTop_PercentMove the window to the left top of the current monitor with a percentage offset
RET_MoveToCurrentMonitor_LeftBottom_PercentMove the window to the left bottom of the current monitor with a percentage offset
RET_MoveToCurrentMonitor_RightTop_PercentMove the window to the right top of the current monitor with a percentage offset
RET_MoveToCurrentMonitor_RightBottom_PercentMove the window to the right bottom of the current monitor with a percentage offset
RET_Window_MaximizeMaximize the window
RET_Window_MinimizeMinimize the window
RET_Window_RestoreRestore the window
RET_Window_Restore_And_MinimizeRestore and minimize the window
RET_SleepDelay execution (milliseconds)
RET_KeyInput_ReplaceAndRollbackRelease existing modifiers, send the keys, and restore the modifiers
RET_KeyInput_AppendAndRollbackSend keys with the existing modifiers and restore their state
RET_KeyDownPress a key
RET_KeyUpRelease a key
RET_KeyInput_CapsLock_OnTurn Caps Lock on
RET_KeyInput_CapsLock_OffTurn Caps Lock off
RET_TextInputEnter text using keybd_event
RET_TextInput_UsingClipBoardPaste text from the clipboard
RET_MouseMove_AbsoluteMove the pointer to absolute coordinates
RET_MouseMove_RelativeMove the pointer by an offset
RET_MouseMove_FromTarget_TopLeftMove the pointer relative to the top-left of the target window
RET_MouseMove_FromTarget_TopRightMove the pointer relative to the top-right of the target window
RET_MouseMove_FromTarget_BottomLeftMove the pointer relative to the bottom-left of the target window
RET_MouseMove_FromTarget_BottomRightMove the pointer relative to the bottom-right of the target window
RET_MouseMove_FromTarget_CenterMove the pointer relative to the center of the target window
RET_MouseMove_PrevMonitor_CenterMove the pointer to the center of the previous monitor
RET_MouseMove_NextMonitor_CenterMove the pointer to the center of the next monitor
RET_MouseMove_From_Desktop_ImageMatch_TopLeftMove the pointer relative to the top-left of the matched image on the desktop
RET_MouseMove_From_Desktop_ImageMatch_TopRightMove the pointer relative to the top-right of the matched image on the desktop
RET_MouseMove_From_Desktop_ImageMatch_BottomLeftMove the pointer relative to the bottom-left of the matched image on the desktop
RET_MouseMove_From_Desktop_ImageMatch_BottomRightMove the pointer relative to the bottom-right of the matched image on the desktop
RET_MouseMove_From_ActiveWindow_ImageMatch_TopLeftMove the pointer relative to the top-left of the matched image in the active window
RET_MouseMove_From_ActiveWindow_ImageMatch_TopRightMove the pointer relative to the top-right of the matched image in the active window
RET_MouseMove_From_ActiveWindow_ImageMatch_BottomLeftMove the pointer relative to the bottom-left of the matched image in the active window
RET_MouseMove_From_ActiveWindow_ImageMatch_BottomRightMove the pointer relative to the bottom-right of the matched image in the active window
RET_MouseClickClick the mouse button
RET_MouseDoubleClickDouble-click the mouse button
RET_MousePositionSave_ExecutionContextSave the pointer position for this execution
RET_MousePositionLoad_ExecutionContextRestore the pointer position for this execution
RET_MatchTrayIcon_ClickClick the matched notification area icon
RET_MatchTrayIcon_DoubleClickDouble-click the matched notification area icon
RET_MatchTrayIcon_EmulateClickEmulate a click on the matched notification area icon
RET_MatchTrayIcon_EmulateDoubleClickEmulate a double-click on the matched notification area icon
RET_MatchTrayIcon_MouseMove_FromTarget_TopLeftMove the pointer relative to the top-left corner of the matched icon
RET_MatchTrayIcon_MouseMove_FromTarget_CenterMove the pointer relative to the center of the matched icon
RET_CopyCurrentMousePointerSelItem_SysListViewCopy selected items from the SysListView32 control under the pointer
RET_CopyCurrentMousePointerAllItem_SysListViewCopy all items from the SysListView32 control under the pointer
RET_CopyCurrentMousePointerCursorItemText_SysListViewCopy the SysListView32 item text under the pointer
RET_Reset_Keyboard_Modifier_ContextReset the keyboard modifier state
RET_Pause_LightWeightHotKeyPause LightWeight HotKey
RET_ChainRule_With_CheckConditionRun a chained rule if its conditions are met
RET_ChainRule_Skip_Condition_AlwaysExecuteRun a chained rule unconditionally

Demo

  • The video shows Ctrl + Win + C copying a SysListView32 (CListCtrl) list to the clipboard.

  • The video shows Win + S + E clicking the Steam notification area icon and activating its window.

  • The video shows Win + F1 activating another window from the same process.

Requirements

  • Windows 10, 11
  • 64bit (AMD64)
  • Visual C++ Runtime (2015-2022)
  • DirectX 9.0 or above

Technologies

  • Windows Hook

Known Issues

  • Antivirus software may monitor apps that use the Windows Hook API. This may affect performance.
    • The hook callback performs small tasks such as checking user-defined rules.
    • Affected antivirus products
      • ESET
      • COMODO
      * The performance impact can be more noticeable with enterprise antivirus products.
  • Compatibility with nProtect GameGuard
    • nProtect GameGuard can block actions such as simulated keystrokes.
    • Affected apps
      • GranSaga

Installation

  1. Extract the downloaded archive.
  2. Run LWHK.exe.
  3. Add your rules.
  4. Start automatically with Windows
    1. Open Options.
    2. Run Install.

Troubleshooting

  • Shortcuts do not work in a high-integrity app
    1. Run LWHK.exe as an administrator.
  • Performance slows over time
    • Restart LightWeight HotKey to reset the modules loaded by your antivirus software.
      • The slowdown may return if the antivirus loads its modules again.
    • Review your antivirus settings for LWHK.exe.
  • Uninstalling
    1. Open Options.
    2. Run Uninstall.