IPWorks ZIP 2020 Python Edition

Questions / Feedback?

ZipSFX Class

Properties   Methods   Events   Configuration Settings   Errors  

The ZipSFX class implements a PKZip-compatible Zip compressor to create a self-extracting archive which will run natively on Windows platforms.

Syntax

class ipworkszip.ZipSFX

Remarks

The class uses the Deflate algorithm specified in RFC 1951 for compression, and then creates a self-extracting executable archive. This exe will bring up a dialog that will allow the user to select the target directory in which to decompress the files. There is also an optional splash screen that may be displayed before decompression. The text for this splash screen may be set with the banner_text property. You can also set the text that appears on the title bar of each dialog box using the caption_text property.

Example (Creating a Self-Extracting Archive)


class.ArchiveFile = "c:\test.exe"
class.RecurseSubdirectories = true
class.SourceDirectory = "c:\foo\"
class.CaptionText = "Testing ZipSFX"
class.BannerText = "Press continue to decompress the archive."
class.CreateSFX()

Note: When creating a self-extracting archive which exceeds 4 GB or more of uncompressed data or which contains more than 64K files, the class will create a 64-bit Zip archive.

The self-extracting archive that is created by the ZipSFX class is a Windows application. However, there are command line options available if you wish to batch multiple files. The options are:

Option NameDescription
targetpathPath to decompress the archive to. This overrides the extract_to_path. "." indicates the current directory (if no extract_to_path was specified and no targetpath is given, the archive is decompressed to the current directory).
overwriteIf set to true, the archive will automatically overwrite existing files (thus suppressing the message box asking you to overwrite or not)
displaymessageIf set to false, it will suppress the display of the "Extraction Complete" message after the archive has finished (this may also be accomplished by setting the CompleteMessage config setting to "").
openfileIf set to false, this option will override opening the file indicated by file_to_execute. (Alternatively, set file_to_execute to "").
passwordThe password used to decrypt the archive. If the archive is not encrypted this option is ignored. However if the archive is encrypted and no password is supplied, decompression will fail.

For example, the following suppresses all questions and message boxes, and decompress to the current directory, use the following options:

  ZipExtractor /targetpath="." /overwrite=1 /displaymessage=0 /openfile=0 /password=pass

Note that if you run the self-extracting archive with any command line options, the pop up message box containing the banner_text will be suppressed.

Property List


The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

archive_fileThe name of the self-extracting zip archive to create.
banner_textOptional banner text to show before the self-extraction starts.
caption_textOptional caption (title) text for the self-extractor dialogs.
compression_levelThe compression level to use.
extract_to_pathOptional target directory for the self-extractor.
file_to_executeOptional file to execute (open) after the archive is extracted.
passwordAn optional password for the self-extracting archive.
recurse_subdirectoriesWhether or not to recurse into subdirectories during archive creation.
source_directoryDirectory to be compressed into a self-extracting archive.

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

configSets or retrieves a configuration setting.
create_sfxCompresses the files and creates a self-extracting archive.
resetResets the class.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

on_errorInformation about non-fatal errors.
on_progressFired as progress is made.

Configuration Settings


The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.

CompleteMessageMessage to notify user that extraction has finished normally.
ExtractorStubPath to optional self-extractor executable stub.
FileToExecuteParamsList of parameters to pass to FileToExecute.
InstallationModeThis setting will install to ExtractToPath, run FileToExecute, and then remove the extracted files.
RequireAdminPrivsSpecifies whether the created executable requires Administrator privileges.
SilentExtractionSpecifies whether the archive should hide all UI interaction while extracting.
BuildInfoInformation about the product's build.
CodePageThe system code page used for Unicode to Multibyte translations.
LicenseInfoInformation about the current license.
ProcessIdleEventsWhether the class uses its internal event loop to process events when the main thread is idle.
SelectWaitMillisThe length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.
UseInternalSecurityAPITells the class whether or not to use the system security libraries or an internal implementation.

 
 
Copyright (c) 2021 /n software inc. - All rights reserved.
IPWorks ZIP 2020 Python Edition - Version 20.0 [Build 7720]