Skip to content

Instantly share code, notes, and snippets.

@JoeGlines
Last active April 26, 2021 15:30
Show Gist options
  • Save JoeGlines/11c01e37b9a402879a4e6534943b0df2 to your computer and use it in GitHub Desktop.
Save JoeGlines/11c01e37b9a402879a4e6534943b0df2 to your computer and use it in GitHub Desktop.
;*******************************************************
; Want a clear path for learning AutoHotkey; Take a look at our AutoHotkey Udemy courses. They're structured in a way to make learning AHK EASY
; Right now you can get a coupon code here: https://the-Automator.com/Learn
;*******************************************************
!d:: ;Wrap on break
Clipboard_Backup_Copy_Selected_Text()
Decoded:=URiDecode(clipboard)
StringReplace,Decoded,Decoded,?,`r`t?,All
StringReplace,Decoded,Decoded,&,`r`t&,All
clipboard:=Decoded
sleep, 100
Clipboard_Paste_and_Restore_Clipboard(Clipboard_Backup)
return
;******for clipboard manipulation and restoring original clipboard*********************************
Clipboard_Backup_Copy_Selected_Text(){
ClipBack := Clipboard ;Store full version of Clipboard
clipboard = ; Empty the clipboard
SendInput, ^c
ClipWait, 1
If ErrorLevel { ;Added errorLevel checking
Clipboard:=ClipBack ;Restore Clipboard
MsgBox, No text was sent to clipboard
Return
}
Return ClipBack
uriDecode(str) {
Loop
If RegExMatch(str, "i)(?<=%)[\da-f]{1,2}", hex)
StringReplace, str, str, `%%hex%, % Chr("0x" . hex), All
Else Break
Return, str
}
Clipboard_Paste_and_Restore_Clipboard(Clipboard_Backup,SleepTime="600"){
SendInput ,^v
sleep, %SleepTime%
Clipboard:=Clipboard_Backup
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment