Size: 2750
Comment:
|
Size: 1595
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
= WinZip = `WinZip` is part of the CategoryAplTree project. <<TableOfContents>> == Warning == Note that WinZip issues an error when you pass something like this with the flag to preserve the directory structure: {{{ C:\My\folder1\file.txt C:\My\folder2\file.txt }}} According to the company behind !WinZip this is nit a bug but by design. Therefore `WinZip` will issue a DOMAIN ERROR if you have to files with the same name in your list of files to be zipped. |
|
Line 3: | Line 19: |
INI files are still useful to provide settings to an application. Vista is not going to change this. The Windows API methods provided to read a particular value have an advantage: they follow a clearly defined search path, and following that path they take not only the INI file into account, they also check the Windows registry and the command line parameter. Furthermore, they deliver always up-to-date values. |
The class "WinZip" relies on an installed version of [[http://winzip.com/win/en/index.htm |WinZip]] '''and''' the command line extension. If both are installed on your machine then will will have the two executables `WZZIP.EXE` (for zipping) and `WZUNZIP.EXE` (for unzipping) somewhere, typically in C:\Program Files (x86)\WinZip. |
Line 6: | Line 21: |
They have a disadvantage as well: they are slow. If you are not interested in the Windows registry and command line parameters, and if you are not changing your INI files while the application is running, then the "!IniFile" class introduced in this article might attract your attention. This class allows you to use a kind of APL-Syntax in your INI files. == Details == An entry like: {{{HomeFolder='C:/Windows/Appl/'}}} results in a string holding the path, but an entry like: {{{FormSize=300 400}}} results in a two-element-vector "!FormSize" holding two Integers. Furthermore, an entry like: {{{LogFolder='{"HomeFolder}Logsfiles/'}}} is treated in a special way: the name between the curlies is treated as the name of an alreday defined value in the same section. It is then replaced by the value of that entry. After creating an instance from the class: {{{MyIni←⎕New #.IniClass 'C:/Appl/Example.ini'}}} you can get all information you are interested in by calling the only method "Get". Given this file "Example.ini": {{{ [GENERAL] MaxNoOfErrors=20 FormSize=800 1200 LogfileFlag=1 LogLevels=1 2 3 * from 1 to 9 [DIR] Home='C:/mainfolder/' AppFolder='{Home}appls/' DocsFolder='{Home}docs/' LogFileFolder='{Home}Logs/' }}} You can get any level of information you are interested in: * list everything * list a particular section * list a particular value in a particular section |
The class makes it very easy to zip as well as unzip stuff. |
Line 57: | Line 25: |
Zip all files in C:\!MyFolder\ recursively into myZipFile.zip: | |
Line 58: | Line 27: |
MyIni.Get ⍬ ⍬ GENERAL MaxNoOfErrors 20 GENERAL FormSize 800 1200 GENERAL LogfileFlag 1 GENERAL LogLevels 1 2 3 DIR Home C:/mainfolder/ DIR AppFolder C:/mainfolder/appls/ DIR DocsFolder C:/mainfolder/docs/ DIR LogFileFolder C:/mainfolder//Logs/ MyIni.Get'General' ⍬ MaxNoOfErrors 20 FormSize 800 1200 LogfileFlag 1 LogLevels 1 2 3 MyIni.Get'General' 'FormSize' 800 1200 MyIni.Get'General' 'Unknown' ¯1 MyIni.Get'General' 'Unknown' ¯1 ¯1 MyIni.Get'Dir' 'LogFileFolder' C:/mainfolder/Logs/ |
(rc more)←#.WinZip.Create 'C:\MyFolder\*' 'myZipFile.zip' |
Line 82: | Line 30: |
>> [:IniFiles/Script:The Script] | Zip two files nto myZipFile.zip: {{{ (rc more)←#.WinZip.Create ('C:\file1' 'C:\file2') 'C:\MyZipFile' }}} |
Line 84: | Line 35: |
Kai Jaeger | Unpack C:\!MyZip.zip into C:\!MyUnzippedFiles\: {{{ (rc more)←#.WinZip.Extract 'C:\MyZip.zip' 'C:\MyUnzippedFiles\' }}} == Project Page == For bug reports, future enhancements and a full version history see WinZip/ProjectPage == Version Information == ||Original author: ||KaiJaeger || ||Responsible: ||KaiJaeger || ||Email: || kai@aplteam.com || <<Include(APLTreeDownloads)>> |
Line 86: | Line 54: |
CategoryDyalog CategoryScriptsAndClasses | CategoryAplTree |
WinZip
WinZip is part of the CategoryAplTree project.
Warning
Note that WinZip issues an error when you pass something like this with the flag to preserve the directory structure:
C:\My\folder1\file.txt C:\My\folder2\file.txt
According to the company behind WinZip this is nit a bug but by design. Therefore WinZip will issue a DOMAIN ERROR if you have to files with the same name in your list of files to be zipped.
Overview
The class "WinZip" relies on an installed version of WinZip and the command line extension. If both are installed on your machine then will will have the two executables WZZIP.EXE (for zipping) and WZUNZIP.EXE (for unzipping) somewhere, typically in C:\Program Files (x86)\WinZip.
The class makes it very easy to zip as well as unzip stuff.
Examples
Zip all files in C:\MyFolder\ recursively into myZipFile.zip:
(rc more)←#.WinZip.Create 'C:\MyFolder\*' 'myZipFile.zip'
Zip two files nto myZipFile.zip:
(rc more)←#.WinZip.Create ('C:\file1' 'C:\file2') 'C:\MyZipFile'
Unpack C:\MyZip.zip into C:\MyUnzippedFiles\:
(rc more)←#.WinZip.Extract 'C:\MyZip.zip' 'C:\MyUnzippedFiles\'
Project Page
For bug reports, future enhancements and a full version history see WinZip/ProjectPage
Version Information
Original author: |
|
Responsible: |
|
Email: |