This function opens the specified file from the archive and checks if the selected archive file has been opened successfully.
object.OpenArchive(aFileName, aPassword)
Part | Attribute | Type | Description |
---|---|---|---|
object |
Required | The object always implements the
ISZipHelper interface |
|
aFileName |
In, Required | string |
The name of the archive file |
aPassword |
In, Required | string |
The password of the archive |
bool
Display OpenArchive for the zip helper.
Dim aDialogue
Dim aSelectArchive
Dim aZipHelper
Dim aOpenArchive
Dim aSelectFolder
Dim aPath
Dim aMessage
Dim aFiles, aFile
Dim aExtracted
Set aDialogue = Profile.CreateOpenDialog
aDialogue.Title = "Select Archive"
aDialogue.Filter = "*.zip||*.*||"
aDialogue.FileName = "*.zip"
aSelectArchive = aDialogue.Execute
if not aSelectArchive then
Profile.MsgBox("No archive file is selected")
exit sub
end if
Set aZipHelper = Profile.CreateZipHelper
aOpenArchive = aZipHelper.OpenArchive(aDialogue.FileName, "")
if not aOpenArchive then
Profile.MsgBox("The selected archive cannot be opened")
exit sub
end if
set aDialogue = Profile.CreateExtShellBrowser
aDialogue.Caption = "Select folder to extract"
aDialogue.Prompt = "Select a folder"
aDialogue.RootPath = "D:"
aDialogue.InitialPath = "D:\"
aSelectFolder = aDialogue.Execute
if not aSelectFolder then
Profile.MsgBox("No folder is selected")
exit sub
end if
aPath = aDialogue.PathName
aMessage = ""
set aFiles = aZipHelper.GetFilesList
for i = 0 to aFiles.Count - 1
aFile = aFiles.Item(i)
aExtracted = aZipHelper.ExtractFile(aFile, aPath)
if aExtracted then
aMessage = aMessage & vbNewLine & aFile & " - successfully"
else
aMessage = aMessage & vbNewLine & aFile & " - error: " & aZipHelper.LastZipError
end if
next
Profile.MsgBox(aMessage)