You're just trying to remap shortcut keys?
SendMode Input ; use SendInput by default for Send
;#IfWinActive, ahk_exe someProg.exe ; ← #IfWinActive would go here
; Remap Win+ArrowKey to Ctrl+ArrowKey
*#Left::Send ^{Left}
*#Right::Send ^{Right}
*#Up::Send ^{Up}
*#Down::Send ^{Down}
If you want to use the Windows key for CMD
then...
; Remap Alt+ArrowKey to Win+ArrowKey
*!Left::Send #{Left}
*!Right::Send #{Right}
*!Up::Send #{Up}
*!Down::Send #{Down}
The star modifier *
allows other modifier keys to be present/active and still trigger. You may or may not want it. And you may need to send {Blind}
(i.e., add this to the send statements) if you don't want the additional modifiers released. See documentation for Send.
If you'd like these swaps to only work in certain programs, use an #IfWinActive
statement preceding the reassignment statements in the script. Alternately, #If WinActive("ahk_exe ProgA.exe") || WinActive("ahk_exe ProgB.exe")
if you want them swapped for multiple (but not all) programs.
It should be evident from above what the key modifiers are (Ctrl = ^
, Alt = !
, Win = #
)... the full list is available here: Hotkeys.
Also, should you eventually need to do more than simple one-liners for key reassignments, just put the statements on the line after the hotkey definition and use a Return
statement to do multiple things for a single hotkey trigger, i.e...
; Scrub the clipboard of formatting and paste...
; This takes two commands, list on the line after hotkey definition
#IfWinActive ; Reset conditional so this will trigger in any program...
+^v::
Clipboard := Clipboard ; Reassign only text back to clipboard vs. ClipboardAll
Send ^v
Return