Integration With Hazel

Hazel is a powerful control center for many file automation tasks and it plays very well together with BetterZip. The interaction of the two works best through AppleScript. Hazel has a basic archiving function, but if you want other formats than zip or encryption, BetterZip is here to help.

Here is a simple Hazel action that watches my DropZip folder and automatically zips every item dropped into it with BetterZip:

Note the output folder inside the DropZip folder. This is where the zipped files will end up without Hazel acting on them. You could, of course, save your zipped files to any other folder outside the DropZip folder, even iCloud Drive or Dropbox. In that case you wouldn’t have to exclude "output" from the name matching in Hazel’s rule definition. Just use “Any file” instead of “Name is not output”.

See, I exclude the output folder from the Hazel rule, so that the created zip files are not zipped again and again and again. The first action is an AppleScript and after that the original file is moved to the Trash. Click the "Edit script" button and copy/paste the script code below.

tell application "BetterZip"
	archive theFile with preset "DropZip"
end tell

theFile is the dropped file supplied by Hazel to its scripts and DropZip is a preset name which I configured in BetterZip. If you prefer, you can include all BetterZip options in the script instead of using a preset.

Here is the BetterZip preset whose name needs to match the one in the script above and the destination folder set to output: