Hi i have been working on this project for weeks now, i am stuck. Help?????
Ok this is what i want to do, i wanted to write a program that will read a text file which has a list of URLs, i want to be able to read these URLs from the file (which i have already done) and put it in the URL box in Internet Explorer (My problem).
Code:
Dim objFSO, objTextFile, strComputer, i, strText, arrComputers(), indx, arrFileLines()
Dim objShell,objOUT, WsShell, ie
Set objShell = CreateObject("WScript.Shell")
indx = 0
i = 0
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("C:\Documents and Settings\agiobop.USWIN\Desktop\Scripts\hosp_list-code.txt", ForReading)
Set objoutputFile = objFSO.CreateTextFile("C:\Documents and Settings\agiobop.USWIN\Desktop\Scripts\copycat.txt")
' Placing text lines into an array
Do Until objTextFile.AtEndOfStream
Redim Preserve arrFileLines(i)
arrFileLines(i) = objTextFile.ReadLine
i = i + 1
Loop
'WScript.Echo i ' <<<<<<<<< Used outside 1st loop as condition for 2nd loop
set ie = createobject("internetexplorer.application") ' run internet explorer
ie.visible = true
While ie.busy ' wait for IE to load-up
DoEvents
Wend
ie.navigate "URL" ' navigate to internet explorer
Do Until indx = i
'WScript.Echo arrFileLines(indx-1)
'ArrCheck = len(arrFileLines(indx-1)) ' <<<<<<<<< veryfies that we actually have the text assigned to arrays
'THIS IS WHERE I WANT TO SEND THE STRINGS IN MY ARRAY TO THE URL
objShell.SendKeys arrFileLines(indx)
objShell.SendKeys "{ENTER}" 'Execute URL
ie.visible = true
While ie.busy ' wait for IE to load-up
Wscript.Sleep 5000
Wend
objShell.SendKeys "%"
Wscript.sleep 100
objShell.SendKeys "+{F10}"
Wscript.sleep 100
objShell.SendKeys "{DOWN}"
Wscript.sleep 100
objShell.SendKeys "{DOWN}"
Wscript.sleep 100
objShell.SendKeys "{DOWN}"
Wscript.sleep 100
objShell.SendKeys "{DOWN}"
Wscript.sleep 100
objShell.SendKeys "{DOWN}"
Wscript.sleep 100
objShell.SendKeys "{DOWN}"
Wscript.sleep 100
objShell.SendKeys "{DOWN}"
Wscript.sleep 100
objShell.SendKeys "{DOWN}"
Wscript.sleep 100
objShell.SendKeys "{DOWN}"
Wscript.sleep 100
objShell.SendKeys "{DOWN}"
Wscript.sleep 400
objShell.SendKeys "{ENTER}"
WScript.Sleep 2000
objShell.SendKeys "^A" ' Highlight
Wscript.sleep 1000
objShell.SendKeys "^C" ' Copy
Wscript.sleep 1000
objShell.SendKeys "%{F4}"
Wscript.sleep 400
indx = indx + 1
Loop
'WScript.Echo indx ' <<<<<<<<< Verify the number of loop iterations
'WScript.Echo ArrCheck <<<<<<<<<<
objTextFile.Close
WScript.Quit
Ok this is what i want to do, i wanted to write a program that will read a text file which has a list of URLs, i want to be able to read these URLs from the file (which i have already done) and put it in the URL box in Internet Explorer (My problem).
Code:
Dim objFSO, objTextFile, strComputer, i, strText, arrComputers(), indx, arrFileLines()
Dim objShell,objOUT, WsShell, ie
Set objShell = CreateObject("WScript.Shell")
indx = 0
i = 0
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("C:\Documents and Settings\agiobop.USWIN\Desktop\Scripts\hosp_list-code.txt", ForReading)
Set objoutputFile = objFSO.CreateTextFile("C:\Documents and Settings\agiobop.USWIN\Desktop\Scripts\copycat.txt")
' Placing text lines into an array
Do Until objTextFile.AtEndOfStream
Redim Preserve arrFileLines(i)
arrFileLines(i) = objTextFile.ReadLine
i = i + 1
Loop
'WScript.Echo i ' <<<<<<<<< Used outside 1st loop as condition for 2nd loop
set ie = createobject("internetexplorer.application") ' run internet explorer
ie.visible = true
While ie.busy ' wait for IE to load-up
DoEvents
Wend
ie.navigate "URL" ' navigate to internet explorer
Do Until indx = i
'WScript.Echo arrFileLines(indx-1)
'ArrCheck = len(arrFileLines(indx-1)) ' <<<<<<<<< veryfies that we actually have the text assigned to arrays
'THIS IS WHERE I WANT TO SEND THE STRINGS IN MY ARRAY TO THE URL
objShell.SendKeys arrFileLines(indx)
objShell.SendKeys "{ENTER}" 'Execute URL
ie.visible = true
While ie.busy ' wait for IE to load-up
Wscript.Sleep 5000
Wend
objShell.SendKeys "%"
Wscript.sleep 100
objShell.SendKeys "+{F10}"
Wscript.sleep 100
objShell.SendKeys "{DOWN}"
Wscript.sleep 100
objShell.SendKeys "{DOWN}"
Wscript.sleep 100
objShell.SendKeys "{DOWN}"
Wscript.sleep 100
objShell.SendKeys "{DOWN}"
Wscript.sleep 100
objShell.SendKeys "{DOWN}"
Wscript.sleep 100
objShell.SendKeys "{DOWN}"
Wscript.sleep 100
objShell.SendKeys "{DOWN}"
Wscript.sleep 100
objShell.SendKeys "{DOWN}"
Wscript.sleep 100
objShell.SendKeys "{DOWN}"
Wscript.sleep 100
objShell.SendKeys "{DOWN}"
Wscript.sleep 400
objShell.SendKeys "{ENTER}"
WScript.Sleep 2000
objShell.SendKeys "^A" ' Highlight
Wscript.sleep 1000
objShell.SendKeys "^C" ' Copy
Wscript.sleep 1000
objShell.SendKeys "%{F4}"
Wscript.sleep 400
indx = indx + 1
Loop
'WScript.Echo indx ' <<<<<<<<< Verify the number of loop iterations
'WScript.Echo ArrCheck <<<<<<<<<<
objTextFile.Close
WScript.Quit