; AutoHotKey Script to Trim White Spaces from Clipboard #Persistent ; Keep the script running #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 ; Hotkey: Ctrl + Shift + T ^+T:: ; Backup the original clipboard content originalClipboard := ClipboardAll ; Wait for the clipboard to contain text ClipWait, 1 ; Trim leading and trailing white spaces using RegEx Clipboard := RegExReplace(Clipboard, "^\s+|\s+$", "") ; Wait a moment for the clipboard content to be updated Sleep, 100 ; Restore the original clipboard content if it was non-text if (Clipboard != originalClipboard) { Clipboard := originalClipboard } ; Notify the user ToolTip, Clipboard trimmed! SetTimer, RemoveToolTip, -2000 ; Show the tooltip for 2 seconds return RemoveToolTip: ToolTip return