Last active
April 26, 2021 15:49
-
-
Save JoeGlines/ab46000e8c740eb0434c9dfca71826b5 to your computer and use it in GitHub Desktop.
Decode a URL for web scraping
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;******************************************************* | |
; 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