#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. #Persistent ; Hotkeys ^Numpad1::Copy(1) ^Numpad4::Paste(1) ^Numpad7::Clear(1) ^Numpad2::Copy(2) ^Numpad5::Paste(2) ^Numpad8::Clear(2) ^Numpad3::Copy(3) ^Numpad6::Paste(3) ^Numpad9::Clear(3) Copy(clipboardID) { global ; All variables are global by default local oldClipboard := ClipboardAll ; Save the (real) clipboard Clipboard = ; Erase the clipboard first, or else ClipWait does nothing Send ^c ClipWait, 2, 1 ; Wait 1s until the clipboard contains any kind of data if ErrorLevel { Clipboard := oldClipboard ; Restore old (real) clipboard return } ClipboardData%clipboardID% := ClipboardAll Clipboard := oldClipboard ; Restore old (real) clipboard } Cut(clipboardID) { global ; All variables are global by default local oldClipboard := ClipboardAll ; Save the (real) clipboard Clipboard = ; Erase the clipboard first, or else ClipWait does nothing Send ^x ClipWait, 2, 1 ; Wait 1s until the clipboard contains any kind of data if ErrorLevel { Clipboard := oldClipboard ; Restore old (real) clipboard return } ClipboardData%clipboardID% := ClipboardAll Clipboard := oldClipboard ; Restore old (real) clipboard } Paste(clipboardID) { global local oldClipboard := ClipboardAll ; Save the (real) clipboard Clipboard := ClipboardData%clipboardID% Send ^v Clipboard := oldClipboard ; Restore old (real) clipboard oldClipboard = } Clear(clipboardID) { global local oldClipboard := ClipboardAll ; Save the (real) clipboard Clipboard := ClipboardData%clipboardID% ClipboardData%clipboardID% := Clipboard := oldClipboard ; Restore old (real) clipboard oldClipboard = }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter