/* Title: SubIE Download and upload using Internet Explorer simulation to bypass any firewall. License: - Version 1.0 by Titan - zlib License */ /* Function: SubIE_Ping Pings a web address. Parameters: url - any valid URI which Internet Explorer can cache without prompting a file download dialog i.e. content served with a text/plain MIME type or similar timeout - maximum time to allow for download before terminating the process Returns: Null if there was no errors. */ SubIE_Ping(url, timeout = 7500) { static d = 1.5 StringReplace, url, url, ", ", All WinGet, a, ID, A Run, "%ProgramFiles%\Internet Explorer\iexplore.exe" "%url%", , Hide, pid If pid = Return, -1 WinActivate, ahk_id %a% WinWait, ahk_pid %pid%, , %d% If ErrorLevel = 0 { WinMinimize WinHide } Sleep, timeout - d * 1000 Process, WaitClose, %pid%, %d% Return, ErrorLevel } /* Function: SubIE_GetFromCache Downloads a file and returns its path. Parameters: url - any valid URI which Internet Explorer can cache without prompting a file download dialog i.e. content served with a text/plain MIME type or similar timeout - maximum time to allow for download before terminating the process Returns: A path to a file whose creation date stamp has the closest proximity to the time this function is called. */ SubIE_GetFromCache(url, timeout = 15000) { t = %A_Now% SubIE_Ping(url, timeout) ;RegRead, d, HKCU, Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders, Cache VarSetCapacity(d, 260, 0) ; MAX_PATH = 260 DllCall("shell32.dll\SHGetFolderPathA" , "UInt", 0 , "Int", 0x0020 ; CSIDL_INTERNET_CACHE , "UInt", 0 , "UInt", 1 ; SHGFP_TYPE_DEFAULT , "UInt", &d) VarSetCapacity(d, -1) SplitPath, url, f Loop, %d%\*, , 1 { tx = %A_LoopFileTimeCreated% tx -= %t%, s If tx > 0 l = %l%%tx%#%A_LoopFileFullPath%`n } Sort, l, N Loop, Parse, l, `n# If A_Index = 2 Return, A_LoopField }