salve ragazzi,
Ho uno script che esegue un confronto tra due file di testo....
ma purtroppo mi da sempre un errore su Ubound:
Subscript out of range : "Ubound"
Questo è lo script completo...spero possiate aiutarmi:
codice:
Dim OggFile, origine, OggTextStream
Set IISOBJ = getObject("IIS://LocalHost/W3SVC")
origine="c:\textstream.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
fso.CreateTextFile (origine)
Set OggFile = fso.GetFile (origine)
Set OggTextStream = OggFile.OpenAsTextStream(2)
For each Object in IISOBJ
if (Object.Class = "IIsWebServer") then
WScript.Echo "WWW Site: " & Object.Name & " - " & Object.ServerComment
OggTextStream.WriteLine "WWW Site: " & Object.Name & " - " & Object.ServerComment
end if
Next
OggTextStream.close
dim filename1
dim filename2
filename1="c:\textstream.txt"
filename2="c:\sitelist.txt"
Set oFSO1 = CreateObject("Scripting.FileSystemObject")
Set oFSO2 = CreateObject("Scripting.FileSystemObject")
Set oTextFile1 = oFSO1.OpenTextFile(filename1, 1 , True)
Set oTextFile2 = oFSO2.OpenTextFile(filename2, 1 , True)
'riempiamo il primo array
dim newarray(1000)
dim i
dim line1
While oTextFile1.AtEndOfStream <> True
line1 = oTextFile1.ReadLine
i = i +1
if (line1<>"") then
newarray(i) = line1
end if
wend
'riempiamo il secondo array
dim oldarray()
i=0
While oTextFile1.AtEndOfStream <> True
line1 = oTextFile2.ReadLine
i = i +1
if (line1<>"") then
oldarray(i) = line1
end if
wend
oTextFile1.close
oTextFile2.close
i=0
dim flag
flag= true
dim c
while i<UBound(newarray)
i=i+1
if newarray(i)<>"" then
flag = true
c = 0
while c<UBound(oldarray)
c = c+1
if oldarray(c)<> "" then
if newarray(i)=oldarray(c) then
flag = false
'exit while
end if
end if
wend
if flag then
'nuovo
'invia email
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "fox80129@xxxx.com"
objEmail.To = "fox80129@xxx.com"
objEmail.Subject = "oggetto"
objEmail.Textbody = objEmail.Textbody = "Dear fox80219, the URL " & newarray(i) & " has been added to the new list"
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.virgilio.it"
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
end if
end if
wend
wscript.echo "Response Retrieve Mail sent"
'End If