Here is one written in Autohotkey:
#NoEnv SetWorkingDir %A_ScriptDir% SendMode Input #InstallKeybdHook #UseHook On (:: if GetKeyState("ScrollLock","T") { sel := GetSelection(1) if sel PasteText("(" sel ")") else Send ( sel := "" } else Send ( Return ":: if GetKeyState("ScrollLock","T") { sel := GetSelection(1) if sel PasteText("""" sel """") else Send " sel := "" } else Send " Return ':: if GetKeyState("ScrollLock","T") { sel := GetSelection(1) if sel PasteText("'" sel "'") else Send ' sel := "" } else Send ' Return {:: if GetKeyState("ScrollLock","T") { sel := GetSelection(1) if sel PasteText("{" sel "}") else Send {{}} sel := "" } else SendRaw { Return [:: if GetKeyState("ScrollLock","T") { sel := GetSelection(1) if sel PasteText("[" sel "]") else Send [ sel := "" } else Send [ Return <:: if GetKeyState("ScrollLock","T") { sel := GetSelection(1) if sel PasteText("<" sel ">") else Send < sel := "" } else Send < Return GetSelection(wait = "") { ClipBack := ClipboardAll Clipboard := "" Send ^c if wait ClipWait 0.05 Selection := Clipboard Clipboard := ClipBack Return Selection }
After installing Autohotkey, save this code in a text file, rename the extension to .ahk and run it. For the code to work, you need to enable Scroll Lock.
This code has been changed from http://www.autohotkey.net/~Vifon/ to:
- Include 'and <
- Write ', ", <, {, [, (instead of' '," ", <>, {}, [], () when no text is selected.
source share