Skip to content

Instantly share code, notes, and snippets.

@elebertus
Created June 25, 2017 18:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elebertus/88e3905acfd69b838eadbfb85ca653d3 to your computer and use it in GitHub Desktop.
Save elebertus/88e3905acfd69b838eadbfb85ca653d3 to your computer and use it in GitHub Desktop.
#SingleInstance on
#WinActivateForce
SetTitleMatchMode RegEx
DetectHiddenWindows, On
SetKeyDelay, 500, 240
; This maps ctrl+1-9 to 1-9 on the target CRD window
; as well as ctrl+NumPad1-8 to alt+1-8 on the target
; CRD window. This is a pretty basic layout, should
; be able to cast all memmed spells and have a pretty
; good mapping to basic hotkeys and macros as well.
;
; You can change this to anything you like by replacing
; the key/value pairs in the EQHotKeys associative array.
; EQHotKeys := {"^1": "1", "^2": "2", "^3": "3", "^4": "4", "^5": "5", "^6": "6", "^7": "7", "^8": "8", "^9": "9", "^+NumPad1": "!+1", "^NumPad2": "!+2", "^NumPad3": "!+3", "^NumPad4": "!+4", "^NumPad5": "!+5", "^NumPad6": "!+6", "^NumPad7": "!+7", "^NumPad8": "!+8"}
nomachineHotKeys := {"<^<!1": "1", "<^!2": "2", "<^<!3": "3", "<^<!4": "4", "<^<!5": "5", "<^<!6": "6", "<^<!7": "+1", "<^<!8": "+2", "<^<!9": "+3","<^<!0": "+4","<^<!-": "+5","<^<!=": "+6"}
cdrkeys := {"<^<!<+1": "1", "<^<!<+2": "2", "<^<!<+3": "3", "<^<!<+5": "4", "<^<!<+5": "5", "<^<!<+6": "6", "<^<!<+7": "+1", "<^<!<+8": "+2", "<^<!<+9": "+3","<^<!<+0": "+4","<^<!<+-": "+5","<^<!<+=": "+6"}
; I can't really explain this logic very well.
; My understanding is that you can't push a
; variable into a lable, so we need to use
; a BoundFunc object so we can pass the params
; Way better explained in this post
; https://autohotkey.com/boards/viewtopic.php?t=31140
for key, mapping in nomachineHotKeys {
fn := Func("SendKey").Bind(mapping)
hotkey, %key%, % fn
}
SendKey(keySent){
global crdWinTitle
WinActivate,ahk_class QWidget
ControlFocus,ahk_class QWidget
Send,%keySent%
WinRestore, ahk_class _EverQuestwndclass
WinActivate,ahk_class _EverQuestwndclass
ControlFocus,ahk_class _EverQuestwndclass
}
for key, mapping in cdrkeys {
fn := Func("CrdSendKey").Bind(mapping)
hotkey, %key%, % fn
}
CrdSendKey(crdKeySent){
global crdWinTitle
ControlFocus,Chrome_RenderWidgetHostHWND1,shitbox1 - Chrome Remote Desktop
ControlSend,Chrome_RenderWidgetHostHWND1,%crdKeySent%,shitbox1 - Chrome Remote Desktop
WinRestore, ahk_class _EverQuestwndclass
WinActivate,ahk_class _EverQuestwndclass
ControlFocus,ahk_class _EverQuestwndclass
}
!+1::
IfWinExist, EverQuest
WinActivate, EverQuest
MouseMove, 897, 473
return
!+2::
IfWinExist,NoMachine - Bootcamp, Windows 10
WinRestore, ahk_class QWidget
WinActivate,ahk_class QWidget
ControlFocus,ahk_class QWidget
MouseMove, 2864, 366
return
!+3::
IfWinExist, shitbox2 - Chrome Remote Desktop
WinActivate, shitbox2 - Chrome Remote Desktop
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment