You can use AppleScript to automate DropDMG. For example:
-- create a new image from a folder
tell application "DropDMG"
-- allow 2 hours before AppleScript times out
with timeout of 2 * 60 * 60 seconds
set p to "~/Desktop/folder" -- POSIX path to source folder
--Specify the options using AppleScript parameters.
create image from path p format NDIF compressed encoding macbinary
end timeout
end tell
-- convert an image to another format
tell application "DropDMG"
-- allow 2 hours before AppleScript times out
with timeout of 2 * 60 * 60 seconds
set p to "~/Desktop/image.img" -- POSIX path to source image
-- Rather than specifying all the options in AppleScript, you
-- can save them as a DropDMG configuration and refer to them
-- that way.
create image from path p configuration name "My Configuration"
end timeout
end tell
You can view DropDMG’s AppleScript dictionary by dragging and dropping the DropDMG application onto Apple’s Script Editor. A collection of example DropDMG scripts is available. create image is the most commonly used command; it lets you make images and archives from folders, files, or other images. Whenever you use create image, you must always include the following parameter:
The remaining parameters are optional.
Instead of specifying all the parameters in AppleScript, you can create a named configuration in DropDMG’s preferences window, and then just specify the name of the configuration in the script, as a string. If you do this, all of the options below, except always create, base name, and volume name are ignored. This is because the other options are specified as part of the configuration. If you specify the empty string ("") as the configuration name, DropDMG uses whichever options are currently set in the Preferences window.
Some Mac OS X files, such as a applications, are actually special folders called packages. The system presents packages to the user as a single file, but they’re actually stored on disk as folders. Normally, when DropDMG makes an image from a folder it copies the contents of the folder into the image; that is, the mounted image behaves just like the original folder did.
Since packages are folders, you can make images of them with DropDMG. However, if DropDMG proceeds as usual, when you mount an image that was created from a package, the Finder will think that the mounted image is a package. It will show the package icon instead of the disk image icon, but it won’t let you double-click the mounted image to access the package (e.g. launch the application). You might think that you could drag the mounted image to your hard disk to launch the application from there, but the Finder will create an alias instead (unless you know to hold down Option).
Therefore, by default, DropDMG recognizes when you are imaging a package and gives you a disk image with the package inside it, instead of making an image of the package. To disable this feature, and thus have DropDMG treat all folders consistently, pass true for this parameter.