Skip to content

Instantly share code, notes, and snippets.

@renatoch
Last active March 31, 2017 23:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renatoch/9424e795b25e381f3eafb5f9aba79871 to your computer and use it in GitHub Desktop.
Save renatoch/9424e795b25e381f3eafb5f9aba79871 to your computer and use it in GitHub Desktop.
Auto Hotkey (AHK) script to paste clipboard content removing non alphanumeric caracters (Hotkey - Ctrl + Alt + Shift + T)
; To be used to paste CPF / CNPJ / bar code copied to clipboard
$^+!t::
Sleep, 100
ClipSaved := ClipboardAll ;save original clipboard contents
Clipboard := RegExReplace(Clipboard, "[^a-zA-Z0-9]", "")
Sleep, 100
Send ^v ;send the Ctrl+V command
Sleep, 100
Clipboard := ClipSaved ;restore the original clipboard contents
ClipSaved = ;clear the variable
Return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment