There are two problems with it:
- The View Downloads window appears if the url is a file link. I could check if the url ends in a common file extension, however, this does not always work. E.g.: https://github.com/maul-esel/FormsFrame ... all/master
- The active window loses focus every so often.
In case anyone has any ideas to solve these problems, or perhaps offer a quite different approach. Cheers.
Code: Select all
JEE_UrlGetRedirected(vUrl, ByRef vTitle="")
{
if !InStr(vUrl, "://")
return "[ERROR]" vUrl
vUrl2 := "[ERROR]" vUrl, vTitle := "[ERROR]"
oWB := ComObjCreate("InternetExplorer.Application")
oWB.Navigate(vUrl)
Loop, % 6000 ;6000*10 = 1 minute
if oWB.busy || !(oWB.ReadyState = 4)
Sleep, 10
else
{
vUrl2 := oWB.document.url
vTitle := oWB.document.title
break
}
oWB.quit
oWB := ""
if (vUrl2 = "")
return "[ERROR]" vUrl
return vUrl2
}