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.
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.
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.
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.
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.
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.
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.
Idem, but with a log file.
Command line example:
macimage -rl e:\projects\file.mipr d:\logs\macimage.log
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.
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.
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.
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.
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
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
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.
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).
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.