OL Learn

Add a Compress or Zip plugin to Workflow

There are times when I need to compress/zip data files for extended backup purposes. Typically I use either 7Zip or xStandard xZip to perform the task. However various companies security department prevent or disallow using anything that is not part of the base install.

It would be nice if there was a compress/zip plugin that was distributed with the base install.

1 Like

In the meantime, here’s a WSC component ( Zipper.zip ) I wrote a while back that I use whenever I need to zip files.

To use it:

  • Unzip the WSC file in some known location (say, C:\Tests)
  • In a Workflow Script task, you can create a Zipper object by using the following syntax:
    var zip = GetObject("script:C:\\Tests\\Zipper.wsc");

Then you can do stuff like:
zip.open("C:\\Tests\\MyZip.zip",Watch);
zip.addFile(Watch.getJobFileName());
zip.extractFile("MyFile.pdf","C:\\Tests");
zip.addContents("<h1>Hello World!</h1>","MySnippet.html");
zip.close();

The WSC file contains a fair amount of comments, so you can read through them to get a better understanding of the available methods