Skip to content

Instantly share code, notes, and snippets.

@JoeGlines
Last active April 26, 2021 15:49
Show Gist options
  • Save JoeGlines/ab46000e8c740eb0434c9dfca71826b5 to your computer and use it in GitHub Desktop.
Save JoeGlines/ab46000e8c740eb0434c9dfca71826b5 to your computer and use it in GitHub Desktop.
Decode a URL for web scraping
;*******************************************************
; 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
;*******************************************************
#SingleInstance,Force
!d:: ;URI Decode and Wrap on break
Send, ^c
Decoded:=URiDecode(clipboard)
StringReplace,Decoded,Decoded,?,`r`t?,All ;replace question mark with line break plus ?
StringReplace,clipboard,Decoded,&,`r`t&,All ;replace & with line break plus &
sleep, 100 ;wait before pasting
Send, ^v
return
uriDecode(str) {
Loop
If RegExMatch(str, "i)(?<=%)[\da-f]{1,2}", hex)
StringReplace, str, str, `%%hex%, % Chr("0x" . hex), All
Else Break
Return, str
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment