Size: 1726
Comment:
|
Size: 0
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
## When you use this page as a template for creating your project page: ## * please remove all lines starting with two hashes (##) ## * except the acl line, please keep that, but remove one hash, so it reads #acl ... ## * fix the acl line so it has the correct page instead of the sample Project/...Group #acl Project/AdminGroup:admin,read,write,delete,revert Project/ReadWriteGroup:read,write Project/ReadGroup:read #format wiki #language en = ZIPping with Windows Shell = ... in Dyalog APL Suddenly I came in need of zipping files. And what more obvious solution than to use the zip-facilities already present in Windows? In essence it can be accomplished in a 3 (+1 if you don't already have a zip file) step process as follows. If need be first create an empty zip file, basically a file with these 22 byte values: 80 75 5 6 0 ... 0: {{{tn←zip_file_name ⎕NCREATE 0}}}<<BR>> {{{(22↑80 75 5 6)⎕NAPPEND tn 83}}}<<BR>> {{{⎕NUNTIE tn}}}<<BR>> Once the zip file is present, create an instance of the Shell COM... {{{'SHAPP'⎕WC'OLEClient' 'Shell.Application'}}}<<BR>> ... get a handle to the files, here a folder and the zip archive, calling the !NameSpace method... {{{ADD←SHAPP.NameSpace⊂add_folder_name}}}<<BR>> {{{FILES←ADD.Items}}}<<BR>> {{{ZIP←SHAPP.NameSpace⊂zip_file_name}}}<<BR>> ... and finally have all files in that folder copied to the ZIP archive, {{{ZIP.CopyHere FILES(4+16)}}}<<BR>> where 4 means "don't display a progress dialog box", and 16 "respond with 'Yes to All' for any dialog box that is displayed". Note that {{{FILES}}} can be a !FolderItems object (as here), a !FolderItem object, or a string that represents a file name. |