https://www.samsung.com/us/mobile/galaxy-note9/phone-plus/
https://www.samsung.com/us/mobile/galaxy-note9/reviews/
https://www.samsung.com/us/mobile/galaxy-note9/compare-andriod/
Usually I don't have an issue with these if I run them in small batches, but if I run them in batches of 100 or more URLs, sometimes I get a 301 when I shouldn't be..
Code: Select all
try Xl := ComObjActive("Excel.Application") ; Try to connect to Active Excel instance
TotalRows := (Xl.Selection.Rows.Count) ; Count how many rows are selected in Excel
SAFEarray := ComObjArray(VT_VARIANT:=12, TotalRows, 1) ; Create SafeArray to insert valid https URLs
Loop, %TotalRows% ; Loop through JSON data in iterations to set each cell with specified data
{
SAFEarray[A_Index-1,0] := (Xl.ActiveCell.Offset(A_Index-1,0).Value)
}
Loop, %TotalRows% ; Make a request for each URL in selection
{
try
{
URLaddress := (SAFEarray[A_Index-1,0]) ; Retrieve cell contents with a valid https URL from SAFEARRAY
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
;=======; RETRIEVE WEB DOCUMENT ;=======;
whr.SetTimeouts(0,30000,30000,120000)
whr.Open("GET", URLaddress, true)
whr.Send()
try
{
whr.WaitForResponse()
}
catch, HTTPrequestTimeout ; handle error if request times out (after 2 minutes)
{
if (InStr((HTTPrequestTimeout.Message), "The operation timed out") != 0)
{
MetaDataFinal := "ERR_CONNECTION_TIMED_OUT: This site can’t be reached - took too long to respond."
GoTo, HTTPrequestTimedoutCanonical
}
else
break
}
if ((whr.Status) != "200") ; if the Status Code of the URL doesn't return a 200
{
MetaDataFinal := (whr.Status) " - " (whr.StatusText) ; Send a message what kind of URL it is
MsgBox % MetaDataFinal
}
}
}
Thanks for any and all insight!