How can I get text scrubbing (Alt + Left / Right / Up / Down) to work more like a Mac on Windows 10? I have CTRL and ALT switched already via:


Now I want to make:

Win + Left / Right / Up / Down to perform like (the original) CTRL + Left / Right / Up / Down (Scrubbing by word)

ALT + Left / Right / Up / Down to perform like OSX's CMD + Left / Right / Up / Down (beginning or end of line / file)


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...
    Clipboard := Clipboard  ; Reassign only text back to clipboard vs. ClipboardAll
    Send ^v

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.