redirect in chrome?

Get help with using AutoHotkey and its commands and hotkeys
Posts: 64
Joined: 07 Dec 2014, 08:41
Facebook: joshatt
Google: joshatt

redirect in chrome?

22 May 2018, 18:23

Hi all,

I'm working on a code to download file, within Chrome, it will get me the save-file popup.
The final line is :

Code: Select all

run D:\other\cent23750\chrome.exe %f1s%
f1s is the file's link.
Sometimes this link will just redirect to a different domain, and will visit as a page, instead of save-file popup. (And the new page url is VALID, no 404 etc.)

How to code: if redirect happens, then...... ?

Posts: 1293
Joined: 01 Oct 2013, 14:57

Re: redirect in chrome?

24 May 2018, 02:21

Code: Select all

url := ""

furl := GetFinalUrl(url)
if (furl != url)
	MsgBox, % furl
	run D:\other\cent23750\chrome.exe %url%

GetFinalUrl(url) {
	whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
	whr.Open("HEAD", url)
	return whr.Option(1)

Return to “Ask For Help”

Who is online

Users browsing this forum: Google [Bot], RaisetheBass and 24 guests