Extracting a zip file using lotus script

Hi,

I have to extract a zip file using lotus script and use the contents of the file for further processing.

I am not aware of how to extract a zip file using lotus script. please help.

TIA

Subject: You can download the free VCZIPSUP DLL and use LotusScript

Check out whether the VCZIPSUP DLL on this page can be used or not.

Bob, creator of VCZIPSUP

Subject: Extracting a zip file using lotus script

I did it a few years ago using the winzip command line (WinZip Command Line - Control and Configure WinZip) if you need it, I can try to find you some sample code of that tonight when I get back home… But it was not very complicated I think…

Subject: RE: Extracting a zip file using lotus script

hi Alain,

Thanks for your response.

Could you kindly give some code to implement this if you have. That would be of great help

TIA

Subject: RE: Extracting a zip file using lotus script

I’ll see if I can find it tonight…

Subject: Here you are

ok here we are, in that example, the zip file name have a standard format and are residing on a predetermined place on the network where the server has a mapped drive… Trigger is the name of the zip file minus the zip extension

Forall file In sTempFiles

If Right(file, 19) = trigger & ".zip" Then

	sBlockName = trigger

	iZipFileFound = True

	sZipfile = file

	sZipfilename = Strrightback(file, "\")



	'unzip the files to temp

sResult = Cmd_Line_Unzip(“C:\Program Files\WinZip\WZUnZip.exe”, “-o”, file, sAgentConfig(“XML Import Files Directory”) & "temp")

	If sResult <> "Success" Then

		' The function will return "Success" in case of success and the error in case of an error	

	End If

Exit Forall

and the function Cmd_Line_Unzip:

Function Cmd_Line_Unzip(Prc_Location As String, Argum As String, File_Loc As String, File_Dest As String) As String

Dim ProcessMgr As New CProcessMgr

Dim errorMessage As String

Dim resultat As Variant



resultat = ProcessMgr.RunCmd(Prc_Location + " " + Argum + " " + File_Loc + " " +  File_Dest)

If resultat = False Then

	Cmd_Line_Unzip = processMgr.GetLastError()

Else

	Cmd_Line_Unzip = "Success"

End If

and lastly the classCProcessMgr:

Class CProcessMgr

Private m_sError As String

Private m_lRetVal As Long



' // RUNS THE COMMAND AND WAITS UNTIL IT IS FINISHED PROCESSING.

Public Function RunCmd(sCmdLine As String) As Integer

	Dim ProcessInfo As PROCESS_INFORMATION

	Dim StartUpInfo As STARTUPINFO

	Dim lRet As Long

	Dim lCreationFlags As Long

	

	On Error Goto RunCmd_Error

	

	StartUpInfo.cb = Len(StartUpInfo)

	

	lCreationFlags = NORMAL_PRIORITY_CLASS+CREATE_NEW_CONSOLE

	lRet = CreateProcessA(0&, sCmdLine, 0&, 0&, False,lCreationFlags , 0&, 0&, StartUpInfo, ProcessInfo)

	

	If lRet = 0 Then

		m_sError = "Error in CProcessMgr::RunCmd() - Unable to create process form command line, "+sCmdLine

		RunCmd = False

		Exit Function

	End If

	

	lRet = WaitForSingleObject(ProcessInfo.hProcess, INFINITE)

	Call GetExitCodeProcess(ProcessInfo.hProcess, lRet)

	Call CloseHandle(ProcessInfo.hThread)

	Call CloseHandle(ProcessInfo.hProcess)

	RunCmd = True

	m_lRetVal = lRet

	Exit Function

RunCmd_Error:

	m_sError = "Error in CProcessMgr::RunCmd() - "+Error

	RunCmd = False

	Exit Function

	

End Function

’ // GETS THE RETURN CODE OF THE COMMAND THAT WAS LAST RUN

Public Function GetRetVal() As Long

	GetRetVal =m_lRetVal

End Function

’ // GETS THE LAST ERROR MESSAGE

Public Function GetLastError() As String

	GetLastError = m_sError

End Function

End Class

Hope that helps, let me know…

Alain

End Function

Subject: RE: Here you are

Hi Alain,

Thanks very much for posting the code.

We are working using it currently. i will reply you to state if it works or not.

Thanks once again