Skip to content

Commit

Permalink
Version 1.0.0.6, updated example for pass through option
Browse files Browse the repository at this point in the history
  • Loading branch information
sebeksd committed Feb 27, 2023
1 parent dbbc33f commit 175ea93
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 5 deletions.
42 changes: 40 additions & 2 deletions AutoHotkey_example.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,43 @@ MsgFunc(wParam, lParam, msg, hwnd)
OnUniqueKeyboard(wParam, lParam & 0xFF, (lParam & 0x100) > 0, (lParam & 0x200) > 0, (lParam & 0x400) > 0, (lParam & 0x800) > 0, (lParam & 0x1000) > 0, (lParam & 0x2000) > 0, (lParam & 0x4000) > 0, (lParam & 0x8000) > 0)
}

; do not modify
byte2hex(int)
{
; based on https://www.autohotkey.com/boards/viewtopic.php?t=3925
; used when doing "passthroug"
HEX_BYTE := 2
while (HEX_BYTE--)
{
n := (int >> (HEX_BYTE * 4)) & 0xf
h .= n > 9 ? chr(0x37 + n) : n
if (HEX_BYTE == 0 && HEX_BYTE//2 == 0)
h .= " "
}
return h
}

; do not modify
DoPassThrough(KeyboardNumber, VKeyCode, IsDown, WasDown, IsExtended, LeftCtrl, RightCtrl, LeftAlt, RightAlt, Shift)
{
VKeyCodeHex := byte2hex(VKeyCode)
PassThroughKey := "{vk" . VKeyCodeHex . "}"

if (LeftCtrl || RightCtrl)
PassThroughKey := "^" . PassThroughKey

if (LeftAlt || RightAlt)
PassThroughKey := "!" . PassThroughKey

if (Shift)
PassThroughKey := "+" . PassThroughKey

Send %PassThroughKey%
}

; KeyboardNumber - configured by you in MultiKB_For_AutoHotkey, this identify keyboard device
; VKeyCode - Key Code, https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
; IsDown - is key pressed or released
; IsDown - is key pressed or released, use "if (!IsDown)" if you like to register only key up, without this your code will be executed twice on key down and key up
; WasDown - like IsDown but this is previous state of this key
; IsExtended - is it normal or extended key (multimedia key, right alt/ctrl etc.)
; LeftCtrl, RightCtrl, LeftAlt, RightAlt, Shift (any) - is corresponding "control key" pressed at the same time
Expand All @@ -32,8 +66,12 @@ OnUniqueKeyboard(KeyboardNumber, VKeyCode, IsDown, WasDown, IsExtended, LeftCtrl
; example, remove, keyboard 1 - "G" + RightCtrl + LeftAlt + Shift
if (KeyboardNumber = 1 and VKeyCode = 71 and RightCtrl and LeftAlt and Shift)
MsgBox "Test message"
; if you want to pass all other keys as normal then add code like below
else if (!IsDown)
{
DoPassThrough(KeyboardNumber, VKeyCode, IsDown, WasDown, IsExtended, LeftCtrl, RightCtrl, LeftAlt, RightAlt, Shift)
}

; ---> Add your code below <---


}
4 changes: 2 additions & 2 deletions MultiKB_For_AutoHotkey.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@
<PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
<VerInfo_Build>2</VerInfo_Build>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.2;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<VerInfo_Build>6</VerInfo_Build>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.6;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
Expand Down
Binary file modified MultiKB_For_AutoHotkey.res
Binary file not shown.
2 changes: 1 addition & 1 deletion src/VK_Codes.pas
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ implementation
{ 6} (VK_Name: 'VK_XBUTTON2'; VK_Description: 'X2 mouse button'),
{ 7} (VK_Name: ''; VK_Description: 'Undefined'),
{ 8} (VK_Name: 'VK_BACK'; VK_Description: 'BACKSPACE key'),
{ 9} (VK_Name: 'VK_TAB'; VK_Description: 'TAB key'),
{ 9} (VK_Name: 'VK_TAB'; VK_Description: 'TAB key'),
{ 10} (VK_Name: ''; VK_Description: 'Reserved'),
{ 11} (VK_Name: ''; VK_Description: ''),
{ 12} (VK_Name: 'VK_CLEAR'; VK_Description: 'CLEAR key'),
Expand Down

0 comments on commit 175ea93

Please sign in to comment.