BetterZip integrates nicely with macOS and supports some of the most widely used third-party productivity apps.
BetterZip adds three actions to Automator:
This action can be configured by selecting one of your current save presets. It needs files and folders as input and returns the created archives as output.
This action can be configured by selecting one of your current extract presets. It needs one or more archives as input and returns the extracted files and folders (only the top level items) as output.
This action will test the input archives and return whether any errors were found. It needs files and folders as input and returns error codes as output (0 means no error).
Using Automator you can easily create BetterZip droplets, small apps onto which you can drop files and folders to compress using a pre-configured preset. The same works for extraction, of course.
Services are no longer as important as they once were. BetterZip offers a contextual menu extension in Finder giving you one-click access to all your presets, and the BetterZip share extension gives you the option to compress documents from within other apps using the Share menu/button. You can enable the BetterZip share extension in System Preferences > Extensions > Share Menu.
Anyway, BetterZip still allows you to add as many services as you wish to the Services menu. Go to BetterZip > Preferences > Presets, choose the preset for which you want to add a service, and click the tools button (with the little gear) below the presets list. Choose “Add this Preset to the Services Menu…” and a sheet will drop down in which you may edit the name for the service. Click OK.
To make it easy to remove services again the tools button menu also has a command “Reveal Services Folder in Finder”. Remove the service by moving it to the trash from this folder.
If you haven’t installed it during the first start of BetterZip, you can install the Alfred workflows at any time by selecting BetterZip > Install Alfred Workflows from the menu. This will add two File Actions to Alfred. “Extract with BetterZip” for archives and “Compress with BetterZip” for other files and folders. Choose the BetterZip action and you will be presented with a list of presets. Choose one and BetterZip will compress or extract the items. See this short tutorial.
Another popular productivity tool is LaunchBar. The LaunchBar actions for BetterZip are installed more like services than like the Alfred workflows, because they are preconfigured for one specific preset. Go to BetterZip > Preferences > Presets, choose the preset for which you want to add a LaunchBar Action, and click the tools button (with the little gear) below the presets list. Choose “Add this Preset to LaunchBar 6…” and a sheet will drop down in which you may edit the name for the action. Click OK.
The creation of Dropzone actions works just like that for LaunchBar. Go to BetterZip > Preferences > Presets, choose the preset for which you want to add a Dropzone Action, and click the tools button (with the little gear) below the presets list. Choose “Add this Preset to Dropzone 3…” and a sheet will drop down in which you may edit the name for the action. Click OK.
Hazel is a powerful control center for many file automation tasks and it plays very well together with BetterZip. See this step-by-step tutorial on how to setup a Hazel action that compresses files with BetterZip.
The base for all automation of BetterZip is its AppleScript support. For the complete scripting definition, open Script Editor and choose File > Open Dictionary… from the menu. Then select BetterZip from the list and click Choose.
You can also script BetterZip with Python (and other languages) through the use of the ScriptingBridge. Here’s a short example that compresses the filename array items
. When doing a queuedArchive or queuedUnarchive, you get back an id that you can use in subsequent calls to progress which returns the progress in percent (0..100). The call to output returns the produced archives. Since BetterZip will quit two seconds after all script operations are done, don’t use a too long polling interval.
import ScriptingBridge
import time
preset = 'Clean and Zip'
BetterZip = ScriptingBridge.SBApplication.applicationWithBundleIdentifier_("com.macitbetter.betterzip")
pid = BetterZip.queuedArchive_withPreset_withOptions_(items, preset, {})
if pid > 0:
a = BetterZip.progress_(pid)
while a < 100 and BetterZip.isRunning():
a = BetterZip.progress_(pid)
# a is the percentage done; do something with it?
time.sleep (1)
archives = BetterZip.output_(pid)
else:
# handle error