Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
inet
active_desktop
active_scrptng
asp.components
asp.db
asp.general
comctl32
comp.packaging
components.dev
dbweb
dhtml_editing
docobjects
html_authoring
html_objmodel
iis
iis.ftp
iis.security
iis.smtp_nntp
indexserver
misc
mshtml_hosting
scripting.jscript
scripting.vbscript
sdk_setup
shell_objmodel
urlmonikers
webbrowser_ctl
wininet
  
 
date: Fri, 27 Jan 2006 16:02:19 -0300,    group: microsoft.public.inetsdk.programming.scripting.vbscript        back       


CAB Files and Windows 2003   
Hi.

I have a little .vbs file with code to generate a .cab file. This .vbs works 
pretty well on Windows 2000, but fails gracefully on Windows 2003. Can 
anyone help me to figure what's going wrong?

Thats the code I am using:


Option Explicit
Call CompactarImagens()

Sub CompactarImagens()
Dim objFSO
Dim objPasta
Dim objArquivo
ReDim arImagens(-1)
Dim strNomeCab
Dim i

i = 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists("c:\Repository) Then
    Set objPasta = objFSO.GetFolder("c:\Repository")

    For Each objArquivo In objPasta.Files
       If objArquivo.Type = "JPG File" Then
           ReDim Preserve arImagens(i)
           arImagens(i) = objArquivo.Path
           i = i + 1
       End If
   Next
Else
   Exit Sub
End If

strNomeCab = Day(Now) & Month(Now) & Year(Now) & ".cab"
Call ConstruirCAB(strNomeCab, arImagens)

Set objFso = Nothing
Set objPasta = Nothing
Set objArquivo = Nothing

Wscript.Quit
End Sub


Sub ConstruirCAB(caminho, imagens)
Dim cab
Dim i
On Error Resume Next

Set cab = CreateObject("MakeCab.MakeCab.1")
cab.CreateCab CStr(caminho), False, False
If Err.Number <> 0 Then
    If Err.Number = 450 Then
        cab.CreateCab CStr(caminho), False, False, False
    Else
       Exit Sub
    End If
End If
On Error Goto 0

If IsArray(imagens) Then
    If UBound(imagens) > -1 Then
        For i = 0 to Ubound(imagens)
             cab.AddFile CStr(Trim(imagens(i))), CStr(Mid(imagens(i), 
InStrRev(imagens(i), "\") + 1))
        Next
    End If
Else
    cab.AddFile CStr(imagens), CStr(Mid(imagens, InStrRev(imagens, "\") + 
1)) End if
    cab.CloseCab
End If

Set cab = Nothing
End Sub


Best regards,
Rinaldo
date: Fri, 27 Jan 2006 16:02:19 -0300   author:   Rinaldo Ferreira

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us