bsharath
asked on
Vbs code change to work on a different website
I have this code that places each website name and gets the status of the website to a output file
Now i need this script to work with this website
http://redirectdetective.com/
Can anyone help
I just want to find the redirected URL's from the URL's i give
Now i need this script to work with this website
http://redirectdetective.com/
Can anyone help
I just want to find the redirected URL's from the URL's i give
Const strInputFile = "input.txt"
Const strOutputFile = "output.txt"
Const C_URL = "http://mtas.surfcontrol.com/mtas/MTAS.asp"
Const C_TXT = " is in our list and categorized as "
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Set objHTTP = CreateObject("MSXML2.XMLHTTP")
Set objInput = objFSO.OpenTextFile(strInputFile, 1, False)
Set objOutput = objFSO.CreateTextFile(strOutputFile, True)
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Visible = True
While Not objInput.AtEndOfStream
' do this now _inside_ the loop because result page does not contain the input form
objIE.Navigate C_URL
While objIE.busy = True Or objIE.ReadyState <> 4
WScript.Sleep 100
Wend
strURL = Trim(objInput.ReadLine)
If strURL <> "" Then
objIE.Document.form1.URL.Value = strURL
objIE.Document.form1.submit
While objIE.busy = True Or objIE.ReadyState <> 4
WScript.Sleep 100
Wend
' find category text; note: first integer, then string
strCategory = InStr(1, objIE.Document.body.innerText, C_TXT, vbTextCompare)
If strCategory = 0 Then
objOutput.WriteLine strURL & ",NOT FOUND"
'WScript.Echo strURL & ",NOT FOUND"
Else
strCategory = Mid(objIE.Document.body.innerText, strCategory + Len(C_TXT))
strCategory = Left(strCategory, InStr(strCategory, vbCrLf) - 1)
'following line is not necessary because property .innerText already strips out HTML
'strcategory = Replace(strcategory, "<font color=#CC0000><b>", "")
strCategory = Trim(strCategory)
objOutput.WriteLine strURL & "," & strCategory
'WScript.Echo strURL & "," & strCategory
End If
End If
Wend
objInput.Close
objOutput.Close
'Set objHTTP = Nothing
objIE.Quit
ASKER
Can you help with the changed code here please..
Line 31
msgbox objIE.Document.form1.URL.V alue
msgbox objIE.Document.form1.URL.V
ASKER
Remove this line
' find category text; note: first integer, then string
add this line?
msgbox objIE.Document.form1.URL.V alue
' find category text; note: first integer, then string
add this line?
msgbox objIE.Document.form1.URL.V
Or keep that line and add rhis above or below it.
ASKER
Not sure if that one line code change can do the job but get this
-------------------------- -
Windows Script Host
-------------------------- -
Script: D:\Test.vbs
Line: 26
Char: 13
Error: Object doesn't support this property or method: 'objIE.Document.form1'
Code: 800A01B6
Source: Microsoft VBScript runtime error
-------------------------- -
OK
-------------------------- -
--------------------------
Windows Script Host
--------------------------
Script: D:\Test.vbs
Line: 26
Char: 13
Error: Object doesn't support this property or method: 'objIE.Document.form1'
Code: 800A01B6
Source: Microsoft VBScript runtime error
--------------------------
OK
--------------------------
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
objIE.Document.form1.URL.V
after line 30