Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Automating the ZIP
Message
 
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
00566018
Message ID:
00576891
Views:
14
>>>>I need to automate the "zipping process". I have winZip 8.0. How do I go about doing this??
>>>
>>>On eof the best programs around is DynaZIP. It comes in a DLL and in an OCX (your choice to use).
>>>
>>>Very easy, and very powerful. It does all that a ZIOP/UnZIP program should do and totally compatible with WinZIP. It even comes with FoxPro code samples
>>>
>>>http://www.innermedia.com/html/dynazip.htm
>>
>>************
>>
>>I have the AX version working ok, however, I have not been able to get their status dll to display anything. The documentation for VB seems pretty straight forward, but it doesn't work for me. I could not find any documentation for VFP. Does anyone have any hints? The download by Mark doesn't mention anything about a display (as far as I could tell)
>
>You can show a status bar for zipping and unzipping by setting a few properties of my wrapper class.

Here is the simple program for archiving using Mark's class:
********************************************************************
*  Description...... : Archive 
*  Calling Samples...: 
*  Parameter List....: tcItemList, tcZipFile, tlDeleteOriginal
*  Created by .......: Nadya Nosonovsky with Mark's comments
*  Modified by.......: Nadya Nosonovsky 04/27/2001 09:47:22 AM
********************************************************************
lparameters tcItemList, tcZipFile, tlDeleteOriginal
*!* vartype tests should always come first. if the parameter
*!* passed is not a character data type, the EMPTY() tests
*!* can give you an error.
if vartype(m.tcItemList)<>'C' or empty(m.tcItemList)     && invalid parameter
   return .f.
endif
if vartype(m.tcZipFile)<>'C'  or empty(m.tcZipFile)          && invalid parameter
   return .f.
endif
local oZip
oZip = newobject("DynaZip", "DynaZip.FXP")
with oZip
     .cZip_ZipFile = m.tcZipFile
     .cZip_ItemList = m.tcItemList
*     .lZip_Recurse = .f.               && not needed because this is the default value
     .lZip_Quiet = .t.
     .lZip_DeleteOriginal = m.tlDeleteOriginal     && Delete the original file
                                        && ARE YOU SURE YOU REALLY WANT TO DO THIS???
                                        && If you really want to do this, then you have to follow the
                                        && comments on this property that are provided in the DynaZip.prg
     .lZip_NoDirNames = .t.
*     .lUnz_NoDirItems = .t.          && this is an unzip option
     .lZip_NoDirEntries = .t.
*     .lZip_CryptFlag = .f.          && not needed because this is the default value
*     .lZip_CryptCode = ""          && not needed because this is the default value
*     .dz_Zip_Function = 4          && not needed. this is taken care of in the ZipAdd method
*     .lUnz_OverWrite = .t.          && this is an unzip option
*     .lUSO_OverWrite_RO = .t.     && this is an unzip option
     .lZSO_MinorCancel = .t.
     .lZSO_ExternalProg = .t.
     .lZSO_ExtProgCancel = .t.
     .cZip_ExtProgTitle = "Adding files to archive "+m.tcZipFile
*     .lZip_NoMsgs = .t.
     llSuccess = .ZipAdd()
     .release()
endwith
release oZip
return m.llSuccess
And here for extracting:
********************************************************************
*  Description.......: Extract
*  Calling Samples...: 
*  Parameter List....: tcDataDir, tcZipFile
*  Created by .......: Nadya Nosonovsky with Mark's comments
*  Modified by.......: Nadya Nosonovsky 04/27/2001 09:50:28 AM
********************************************************************
lparameters tcDataDir, tcZipFile
*!* vartype tests should always come first. if the parameter
*!* passed is not a character data type, the EMPTY() tests
*!* can give you an error.
if vartype(m.tcDataDir)<>'C' or empty(m.tcDataDir)     && invalid parameter
     return .f.
endif
if vartype(m.tcZipFile)<>'C' or empty(m.tcZipFile)     && invalid parameter
     return .f.
endif
tcZipFile = alltrim(m.tcZipFile)
if not file(m.tcZipFile)               && invalid file or invalid path to file
     return .f.
endif
local oZip
oZip = newobject("DynaZip", "DynaZip.FXP")
with oZip
     .cUnz_ZipFile = m.tcZipFile
     .cUnz_FileSpec = "*.*"
     .cUnz_Destination = m.tcDataDir
*     .lUnz_OverWrite = .t.          && not needed. these are the default values
     .lUnz_Quiet = .t.
*     .lUnz_NoDirNames = .t.          && not needed. these are the default values
*     .lUnz_Recurse = .f.               && not needed. these are the default values
*     .lUnz_NoDirItems = .t.          && not needed. these are the default values
*     .lUnz_CryptFlag = .f.          && not needed. these are the default values
*     .lUnz_CryptCode = ""          && not needed. these are the default values
*     .dz_Unz_Function = 8          && not needed. handled by UnzExtract method
     .lUSO_OverWrite_RO = .t.
     .lUSO_MinorCancel = .t.
     .lUSO_ExternalProg = .t.
     .lUSO_ExtProgCancel = .t.
     .cUnz_ExtProgTitle = "Extracting files from "+m.tcZipFile
     .lUnz_NoMsgs = .t.
     llSuccess = .UnzExtract()
     .release()
endwith
release oZip
return m.llSuccess
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform