Hi,
Below is the code I created that reads from a text file, a hyperlink, for
example http://yahoo.com. Then creates a URL shortcut.
Is there any way in VBscript to save a web page automatically just like
clicking on "file" and then "save as".
I would like to read a url from a file and save the web page to my local
drive just like clicking "file" and "save as"
Const ForReading = 1
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = WScript.CreateObject ("WScript.shell")
Set oInputFile = oFSO.OpenTextFile("links.txt", ForReading)
arrInputData = Split(oInputFile.ReadAll, vbNewline)
For each strData In arrInputData
if strData = "" then
strNull = strData
else
call createLink(strData)
end if
Next
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
sub createLink(Data)
strLinkName = Data
strfileName = SetFileName(strLinkName)
set oUrlLink = oShell.CreateShortcut(strFileName & ".url" )
'set oUrlLink = oShell.SaveAS(strFileName & ".htm" )
oUrlLink.TargetPath = strLinkName
oUrlLink.Save
end sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function SetFileName(Name)
temp = mid(Name,8)
newString = "$"
oldString = "/"
setFileName = Replace(temp,oldstring,newString,1,-1,1)
end function