Trying to Unzip Files from Script

Have an app where users are going to drop files in a RTF. Files are going to be a couple zip files and a PDF. I have validation in place for files. Then need to pull the files out of the zips and process them. Done a lot of looking and found Julian’s stuff and Voith’s Code on this but it all seems at least a few years old and just wanting to verify that it is still consider the most efficient way to unzip a file from within a NotesClient Document (Upon Save/Submit). I see a Unzip.Dll in my Notes folder and I am adding VCZipSup.dll as well. Using Lotuscript in the QuerySave event, but not married to that solution if there is a better way.

Appreciate any suggestions or help that you can give.

Thanks,

Steven Cannon

Subject: My Final Solution

Tried a few ways and ended up utilizing the ZipManager solution. I appreciate the feedback from all of you.

This is on a web content form that we use to post files for our financial reports (PDF’s) and we are now adding in the XBRL documents and their accompanying HTML files that we get quarterly in 2 zip files.

What I ended up doing is to add a button to the form for the XBRL publishing and that let’s the user select the 2 zip files and it copies them to a share on the network. Then they fill out a popup form for all financial posting information needed. Then submit. The Submission creates a link to 1 of the zip files, unzips both files into a directory structure such as Q12010\XBRL & Q12010\HTML and then puts those unzipped files in the appropriate directory adds in the links to them on the content form and saves it and routes it for approval.

This works well without having to add any files into our notes data directory or anything like that with a simple Lotus Script Button calling the Java Library.

So thanks again.

Steven

Subject: I’d use Java…

  • You should be able to use LS2J to instantiate Java’s Zip management class and not rely on (direct) DLL usage (assuming that’s what’s being done now … haven’t read the cited material). Long as you don’t try to give or receive a null (not “”, that’s okay) I’ve had little trouble with using Java classes in LotusScript.

  • Given how arcane it is to instantiate Java, though, it will be more legible and “cleaner” to build a wrapper class in LotusScript so your code looks like it’s just calling a native object.

  • I do this to generate hashes and it “works a treat”, as they say.

Hope this helps…

Subject: ZipFileManager?

You mean along the lines of like this - nsftools - Lotus Notes and Domino Tips

Julian created this a few years ago, is that what you mean by the Java wrapper classes or something else?

BTW - Thanks Julian for leaving the posts out there from back then so I could find them via google. :o)

Steven

Subject: I was thinking more like the ZipFileManager LS class…

  • It’s not necessary to have the separate JAR to make this work. The ZipFileManger LS class may directly instantiate the built-in Java ZIP object instead of doing two extra wrapper layers (zfmWrapper4LS & the jar class itself). The way you do it is the same, but set zfmClass to javax.util.ZipFile do your createObject call using one if it’s constructor formats.

  • I’m sure some other shenanigans will be necessary because ZipFile uses and returns other Java objects, so it may be simpler to add one more layer in Java to make it work with simple data types, but that’s not strictly necessary. One could put the required code directly in ZipFileManager and leave it at that, at the expense of more JavaClass objects (and imho more clutter) in the ZipFileManager class code. If you do put another layer in Java you can do it right in Designer using a Java Script Library, then include that library in your LS project settings. No need for external code at all, which is why I suggested it.

  • At least that’s how I see it.

Hope this helps…

Subject: Not that old … And still works pretty well!

http://www.vcode.no/vcode.nsf/downloads/VCZIPSUP

Subject: Stand corrected & Another Solution

Saw this one and am going to give it a try and I stand corrected in that it is not that old. :o)

I also found this one from '04.

http://searchdomino.techtarget.com/tip/1,289483,sid4_gci1002690,00.html

Thanks for the help.

Steven

Subject: looks interesting

I’ve looked for something like this before. If it works it may be very helpful.

Thanks for posting it.