; ============================================================ ; ClipboardHistoryLite.ahk ; ; Tracks the last 10 things you've copied. Press Ctrl+Alt+V to see a ; numbered list and pick one to copy back to the clipboard. ; ; (Windows 10/11 already has a built-in clipboard history via Win+V — ; this is a minimal roll-your-own alternative for older systems or ; when the built-in one is disabled by policy.) ; ; Requirements: AutoHotkey v2 (https://www.autohotkey.com/) ; ============================================================ #Requires AutoHotkey v2.0 history := [] OnClipboardChange(ClipChanged) ClipChanged(type) { global history if (type = 1 && StrLen(A_Clipboard) > 0) { history.InsertAt(1, A_Clipboard) if (history.Length > 10) history.RemoveAt(11) } } ^!v::{ global history if (history.Length = 0) { MsgBox("Clipboard history is empty.") return } list := "" for index, entry in history { preview := SubStr(StrReplace(entry, "`n", " "), 1, 60) list .= index ". " preview "`n" } choice := InputBox("Enter the number of the item to copy back:", "Clipboard History", "w400 h300", list) if (choice.Result = "OK" && choice.Value is Integer && choice.Value >= 1 && choice.Value <= history.Length) A_Clipboard := history[Integer(choice.Value)] }