Skip to content

Instantly share code, notes, and snippets.

@JoeGlines
Last active October 14, 2022 16:40
Show Gist options
  • Save JoeGlines/0fe77ac53d964c6ef2a24d6691d71100 to your computer and use it in GitHub Desktop.
Save JoeGlines/0fe77ac53d964c6ef2a24d6691d71100 to your computer and use it in GitHub Desktop.
#Requires AutoHotkey v1.1.33+
#requires 32 bit version of AutoHotkey
MsgBox % URiEncode("https://the-Automator.com?Src=news&id=1211")
uriDecode(str) {
Loop
If RegExMatch(str, "i)(?<=%)[\da-f]{1,2}", hex)
StringReplace, str, str, `%%hex%, % Chr("0x" . hex), All
Else Break
Return, str
}
UriEncode(Uri, full = 0){
oSC := ComObjCreate("ScriptControl")
oSC.Language := "JScript"
Script := "var Encoded = encodeURIComponent(""" . Uri . """)"
oSC.ExecuteStatement(Script)
encoded := oSC.Eval("Encoded")
Return encoded
}
;********************forces 32-bit version***********************************
if ((A_PtrSize != 4 || !A_IsUnicode) && !A_IsCompiled){
SplitPath,A_AhkPath,, ahkDir
if (!FileExist(correct := ahkDir "\AutoHotkeyU32.exe"))
{
MsgBox, % 0x10, "Error", "Could not find the 32bit unicode version of Autohotkey in:`n" correct
ExitApp
}
Run,"%correct%" "%A_ScriptName%",%A_ScriptDir%
ExitApp
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment