MacImage Command Line Interface

Summary: MacImage can also be used with a command line interface. Automatically opening the application by a double-clic on a project icon. Command line utility for project creation, file insertion, project refreshing, project compilation to produce the image file, hybridation of an ISO image, decompression of a DMG image.
 

Introduction

Even if MacImage is a Windows application with a GUI (Graphical User Interface), it may be useful, for some tasks, to launch it with a command line.
This is what happens, behind the curtain, when you double-click on the icon of a project file. As MacImage registered its file extensions (*.mipr, *.hfs and *.isop) with Windows, the Explorer launches MacImage when the user double-clicks on an icon.
The command line can be more useful, yet.
MacImage offers several command line functions (switches):

Caution: the result codes given below only apply to the command line version of the program (micl.exe). Result code 1 is a inconsistent command line problem.

Files and Folders Inclusion (-i)

Command line example:

macimage -i e:\projects\file.mipr c:\temp\folder\file.ext

In this command line, MacImage opens the project named file.mipr (or creates it if it doesn't exist) and includes the following item, c:\temp\folder\file.ext. This item is a file in this example, but could be a folder. In such a case, all files and folders contained within the folder are also included.
It is also possible to use a file containing the list of the files or folders to include in the project.
Command line example:

macimage -i e:\projects\file.mipr $c:\temp\folder\file.ext

Note in this example the presence of the dollar sign in front of the file name. In such a case, MacImage opens the file and includes the files and folders listed in it (with full access path).
Result codes (only with micl.exe):
  0 - Success.
-1 - Unable to open the project file.
-2 - Unable to create the list file.
-3 - The element to be included is whether a file nor a folder.

Inclusion in the ISO View Only (-ii)

Command line example:

macimage -ii e:\projects\file.mipr c:\temp\folder\*.*

This command line tells the program to add the whole content of the folder named "folder" to the project, but only in the ISO view. Note the use of the syntax "*.*" to include all files.
You could also use a pattern like "*.doc", etc.

Inclusion in the HFS View Only (-ih)

Command line example:

macimage -ih e:\projects\file.mipr c:\temp\mac\*.*

Similarily, this command line includes the content of the folder named "mac" to the HFS view of the project.

Project Labelling (-l)

Command line example:

macimage -l e:\projects\file.mipr "Name with spaces"

This command line gives the label to both views.
There is also a variant '-li' to only label the ISO view and '-lh' to only label the HFS view.
Result codes (only with micl.exe):
  0 - Success.
-1 - Unable to open the project file.

Folder Creation (-f)

Command line example:

macimage -f e:\projects\file.mipr "Name with spaces/folder2"

This command line creates the folders (you can concatenate any number) in both views.
There is also a variant '-fi' to only create the folder in the ISO view and '-fh' to only create the folder in the HFS view.
Result codes (only with micl.exe):
  0 - Success.
-1 - Unable to open the project file.

Project Refreshing (-r)

It happens frequently that the contents of the original hard disk changes between the project creation step and the image compilation.
The interactive version of MacImage offers two features coping with this aspect of things: Project Refreshing and Project Rebuilding.
There is also a corresponding command line feature.
Command line example:

macimage -r e:\projects\file.mipr

MacImage opens the project named file.mipr and updates the dates and size of all files, and the contents of all folders (which are handled as if the Rebuild menu item was checked).
With this feature, you can for instance publish a periodic CD-ROM with a folder whose contents changes with each issue. You build a CD-ROM project with a place holder (an empty folder for the changing contents), then, for the actual production, you put the files to be included in the folder (or rename the actual folder with the place holder name) and refresh the project before compiling it.
Please note that refreshing to delete files and folders in the project file is useless, since MacImage silently ignores files and folders which don't exist anymore at compile time.
Result codes (only with micl.exe):
  0 - Success.
-1 - Unable to open the project file.

Project Refreshing (-rl)

Idem, but with a log file.
Command line example:

macimage -rl e:\projects\file.mipr d:\logs\macimage.log

Project Compilation (-c)

Command line example:

macimage -c e:\projects\file.mipr

MacImage opens the project file (file.mipr) and compiles it, producing a file named file.iso.
Please note that the Refresh flags (for the volume or for folders) are not applied in the command line compilation. Use the refresh option above.
Latest version of the program offers two new switches : -ci to compile as ISO only a hybrid project and, conversely, -ch to compile as HFS/HFS+ only.
Result codes (only with micl.exe):
  0 - Success.
-1 - Unable to open the project file.
-2 - Unable to create the target file.
-4 - Not enough free room on the target disk.

Image Hybridation (-h)

Command line example:

macimage -h e:\projects\image.hfs e:\projects\image.iso

MacImage opens the ISO image (image.iso) and adds the HFS image (image.hfs).
Result codes (only with micl.exe):
  1 - Success
-1 - Unable to open the ISO image.
-2 - Unable to open the HFS image.
-3 - The ISO image was already hybridated.
-4 - The ISO image is not correct.
-5 - The HFS image can't be exploited (unable to decompress it, or unable to know which image it is).
-6 - Error opening a temporary file for the decompression.

Image Dehybridation (-dh)

It can be useful to delete the HFS image put into the ISO image (hybridation). This is the aim of this command.
Command line example:

macimage -dh e:\projects\image.iso

MacImage opens the ISO image (image.iso) and deletes the HFS image.
Caution: This function only works on a hybrid image where both file systems are totally separated, that is on the result of the hybridation process in MacImage, not on the result of the production of an image with data sharing between file systems.
Result codes (only with micl.exe):
  0 - Success
-1 - Unable to open the ISO image.
-2 - Other error causes.

Disk Image Decompression (-dc)

Several tools exist on the Macintosh to produce and manage so-called disk images. A disk image is a plain copy of a real disk, sector after sector, or it is more simply a data container which mimics a virtual disk and stores files and folders. It often happens that the images are compressed, sometimes without knowledge of the user. It can be useful to decompress those images. This is the aim of this command.
Command line example:

macimage -dc e:\data\image.dmg e:\data\imgdec.dmg

MacImage opens the UDIF image and decompresses the data in the target file.
MacImage manages the images compressed with the ADC, Zlib and BZlib2 schemes.
See also a more technical page on Macintosh Disk Images.
Result codes (only with micl.exe):
  1 - Success
-1 - Unable to manage the compressed image.
-2 - Nothing to do (uncompressed image), or unable to open the source or the target image.

Command Line Burning

Using a command line burning software like the cdburn.exe or the dvdburn.exe utilities distributed by Microsoft in its Windows 2003 Resource Kit (only installs under Windows XP and later, but also runs under Windows 2000), you could launch the compilation and the burning in one batch file containing only two lines, which could be:

macimage -c e:\projects\file.mipr
cdburn d: file.iso -speed max

Synchronization with the project file

If the project file and the data files are on different drives, we consider that the root of the data disk and the root of the projected image are the same. That means that a file in the root folder of the data disk will appear in the root folder of the image.
Similarily, a file to be included, contained in a folder named temp, for instance e:\temp\file.ext, will appear in a 'temp' folder in the target image.
On the other hand, if the project file and the data files are on the same disk, we substract the project access path from the data file access path to select the folder in which the data file will appear.
For the time being, we're thinking about a method to put precisely a data file at a specific folder level in the image project. If you have any ideas about how this should be done, don't hesitate to chime in.
Here is a solution we found with the help of an user:
The principle is to change to the data disk, to change to the data folder, and to insert the file without any access path. The data files are then included in the root of the project.
The original command line:

macimage -i e:\projects\project.mipr c:\temp\file.ext

is replaced by following code snippet:

c:
cd \temp
macimage -i e:\projects\project.mipr file.ext

Frequent Error Causes

When you use several command lines in a batch file, don't forget to give a full access path for the project file and for the data files.
The execution of a command line can change the default current folder and the program may therefore not be able to find again the project file created the line before.

File Path

Within the command line interface, MacImage manages identically the classical file access paths (where a letter was assigned to the volume, for instance Z:\) and UNC paths (\\server\share\file).

Executable

MacImage exists also as a pure command line tool (micl), which is smaller and easier to use in a batch file. It is bundled in the main installation program. For testing purposes, please use the main executable and launch it from the command line. Normally, the result should be the same.

 
Logiciels & Services Duhem
3, rue Pierre Haret - F-75009 Paris (France) - Tel. (+33) [0]149 700 455 - SIRET 381 149 996 00047 - EEC VAT FR32 381 149 996
email: sales (at) macdisk.com — web: http://www.macdisk.com