Omni Systems, Inc.

  

Mif2Go User's Guide, Version 33u53

  

Valid HTML 4.01!

 

Made with Mif2Go

32 Automating Mif2Go conversions > 32.4 Automating conversion workflow > 32.4.2 Executing system commands before and after conversion > 32.4.2.2 Understanding how system commands work


32.4.2.2 Understanding how system commands work

When you assign a system command or a macro to a Book*Command or File*Command in the [BookFileCommands] section, Mif2Go generates one or more lines of code, each of which is a command to be run at a Windows command prompt. Mif2Go writes these lines to a .bat file whose name is one of the following:

BookStartCommand.bat

BookWrapCommand.bat

BookEndCommand.bat

FileStartCommand.bat

FileWrapCommand.bat

FileEndCommand.bat

To make the commands in the .bat file (and the system responses) visible in a Windows command-prompt window while the conversion is running:

[BookFileCommands]

; BookCommandWindow =

;  Hide (default, no display),

;  Keep (show until user dismisses),

;  Show (during execution only)

BookCommandWindow=Show

; FileCommandWindow = Hide (default), Keep, or Show,

;  for single document files.

FileCommandWindow=Show

The .bat file starts with:

REM For: path/to/bookfilename

@ECHO Running batfilename

@ECHO ON

If BookCommandWindow=Show or Keep, @ECHO ON causes the rest of the commands in the .bat file to be visible as they are executed. As the .bat file runs, you see each command and its response. If there is an error, you see the error message even before the Running batfilename line, an unavoidable Windows feature (because stderr cannot be redirected to stdout).

If BookCommandWindow=Show or Keep, the next line in the .bat file after your system commands is:

@ECHO Finished batfilename

If BookCommandWindow=Keep, the .bat file ends with:

@PAUSE

so that you can see what happened.

Note:  

Do not specify BookCommandWindow=Keep for unattended use, because the .bat file would wait forever for you to press a key.

The .bat file remains in the project folder, so you can see what it contains. The next time you run the same kind of command, Mif2Go recycles the .bat file.



32 Automating Mif2Go conversions > 32.4 Automating conversion workflow > 32.4.2 Executing system commands before and after conversion > 32.4.2.2 Understanding how system commands work