Skip to content

Instantly share code, notes, and snippets.

@Naetmul
Created February 6, 2023 07:04
Show Gist options
  • Save Naetmul/c609dab5414c6ba060491cba9ba20a89 to your computer and use it in GitHub Desktop.
Save Naetmul/c609dab5414c6ba060491cba9ba20a89 to your computer and use it in GitHub Desktop.
AutoHotkey script to "Paste As Text" when Ctrl+Win+V is pressed (for AHK v2.0)
#Requires AutoHotkey v2.0
^#v:: ; Ctrl + Win + V
{
ClipboardOld := ClipboardAll() ; Save the original clipboard contents
; A_Clipboard is a built-in variable that reflects the current contents of
; the Windows clipboard if those contents can be expressed as text.
A_Clipboard := A_Clipboard
SendInput "^v" ; Send Ctrl + V (SendInput is faster than Send)
Sleep 250 ; Give some time to finish paste (before restoring clipboard)
; The built-in variable A_Clipboard reflects the current contents of the
; Windows clipboard expressed as plain text, but can be assigned a
; ClipboardAll object to restore its content to the clipboard.
A_Clipboard := ClipboardOld
ClipboardOld := "" ; Clear temporary variable (potentially contains large data)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment