Delete::Backspace
Backspace::Delete
did not work for me, because I need to turn it on and off quite a lot as I move around.
So, I wrote the following.
Would post it to some AutoHotKey sharing site, but can't seem to access such at the moment.
;
; AutoHotkey Version: 1.0.48.3
; Language: English
; Platform: Win9x/NT/XP
; Author: Andy Glew: andy.glew@intel.com, ag-ahk@patten-glew.net
;
; Script Function:
; Swap Delete and Backspace
; with a menu to enable/disable.
;
; Why?: because I am constantly docking and undocking my laptop
; when undocked I don't need to swap Del and BS
; but when docked at work, with my Happy Hacker keyboard, I do.
;
; And I found that killing the script was a bit too annoying.
;-----------------------------------------------------------------------------
#InstallKeybdHook ; unconditionally installing the keyboard hook.
; TBD: may not be necessary
; TBD: may waste memory and slow down system
#SingleInstance force ; replace any already running instance of this script
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; Autoexec'ed
Menu,DeleteBackspace,Add,Swap backspace and delete,ToggleBsDelSwapSetting
Menu,DeleteBackspace,Add,#!Del/BS - this menu to enable/disable,ToggleBsDelSwapSetting
SwapBackspaceAndDelete = 0
Return
ToggleBsDelSwapSetting:
Menu,DeleteBackspace,ToggleCheck,Swap backspace and delete
SwapBackspaceAndDelete := SwapBackspaceAndDelete ^ 1
Return
;=============================================================================
; #-Win, !-Alt, ^-Ctl, +-shift
; # right Win, etc.
; * - ignore other modifiers
; $ - prevent self-recursion (e.g. {Del} can send {Del}
;=============================================================================
; On the Happy Hacker keyboard, I need to swap Delete and Backspace
; TBD: I wish that I could create a function to do such swapping, but I seem to be unable to in AutoHotKey
$Delete::
;MsgBox Delete %SwapBackspaceAndDelete%
if ( SwapBackspaceAndDelete ) {
SendPlay, {BackSpace}
}
else {
SendPlay, {Delete}
}
Return
$BackSpace::
;MsgBox BackSpace %SwapBackspaceAndDelete%
if ( SwapBackspaceAndDelete ) {
SendPlay, {Delete}
}
else {
SendPlay, {BackSpace}
}
Return
$NumpadDel::
;MsgBox NumPadDel %SwapBackspaceAndDelete%
if ( SwapBackspaceAndDelete ) {
SendPlay, {BackSpace}
}
else {
SendPlay, NumPadDel}
}
Return
#!Delete::
#!BackSpace::
#!NumpadDel::
Menu,DeleteBackspace,Show
Return
No comments:
Post a Comment