Visualizzazione dei risultati da 1 a 2 su 2

Discussione: [VB6] Ubound error

  1. #1

    [VB6] Ubound error

    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
    Dade2 • Premium Windows Hosting • Microsoft Partner
    Server Dedicati • R1Soft daily backups • Dedicated Account Managers

  2. #2
    L'errore dovrebbe essere dovuto al fatto che è un Array dinamico, prova a vedere se fa al caso tuo l'istruzione Redim Preserve. Aspettiamo comunque l'intervento di qualcuno più esperto.
    ms-help://MS.MSDNQTR.2003FEB.1040/vblr7/html/vastmReDim.htm

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.