withSolutions   Script Sample Showcase
 
Skip Navigation Links.   This is a class object that allows a Web Based Application, Console Application, or Windows Application to shell out to a Command Line Application. In this case we are using WinZip’s Command Line Add-on utility. It may be uncommented to allow unzipping a password protected zip file.

          Sub UnZipQ(ByVal FoundZipFile As String)       

                    zFilename = "C:\Production\Processed\" & FoundZipFile

                    'zPassword = "SPAAT1525"

                    zfileDir = " C:\Production\In\"

                    doUnZipFile()

          End Sub

  

          Sub doUnZipFile() 'this sub for using more than one sending dirs

                    'UnZipFile(zFilename, zPassword, zfileDir)

                    UnZipFile(zFilename, zfileDir)

                    System.Threading.Thread.Sleep(10000)

          End Sub

  

  

          Public zFilename As String

          Public zPassword As String

          Public zfileDir As String

          Public FoundZipFile As String

          Public FoundTxtFile As String

          Public passedname As String

  

          ' DeCompressing Files using WINZIP's wzunzip.exe

          ' Need a legal copy of WinZip 8 on local PC & their download for command line calls.

          ' Side Effects: May need to slow down dot.net for returning from the shelling to cmd

          '**************************************

  

          Public Function RunExe(ByVal strCommandLine As String)

                    ' This function simply executes a commandline on the file system.

                    'Windows.Forms.Application.DoEvents()

                    Dim objShell As System.Object

  

   

  

                    'Now run the unzip string

                    objShell = CreateObject("WScript.Shell")

                    objShell.run(strCommandLine)

                    System.Threading.Thread.Sleep(10000)

                    objShell = Nothing

  

                    'Use this to change the attribs for deleting zip and/or read only files

                    objShell = CreateObject("WScript.Shell")

                    objShell.run("attrib -r /S " & Mid(zfileDir, 1, InStrRev(zfileDir, "\")) & "*.zip")

                    System.Threading.Thread.Sleep(10000)

                    objShell = Nothing

  

          End Function

  

  

          Public Function UnZipFile(ByVal strFileNames As String, ByVal strFileDir As String)

                    'Public Function UnZipFile(ByVal strFileNames As String, ByVal strPassword As String, ByVal strFileDir As String)

                    'Windows.Forms.Application.DoEvents()

                    Dim strCommand As String

                    'strCommand = "wzunzip " & "-o -s" & ControlChars.Quote & strPassword & ControlChars.Quote & " " & strFileNames & " " & strFileDir

                    strCommand = "wzunzip " & "-o " & strFileNames & " " & strFileDir

                    RunExe(strCommand)

  

        End Function