Omni Systems, Inc.

  

Mif2Go User's Guide, Version 55

  

Valid HTML 4.01!

 

Made with Mif2Go

34 Automating Mif2Go conversions > 34.4 Executing operating-system commands > 34.4.6 Supplying system commands in a macro


34.4.6 Supplying system commands in a macro

You can put system commands in a Mif2Go macro. A macro consists of a special configuration-file section to which you give a unique name; you invoke the macro by assigning its name, enclosed in <$ >, to a System*Command keyword. See §28.1 Defining and invoking macros.

For example, suppose your workflow requires backing up your FrameMaker files to two servers. You could define a macro to supply the two copy commands, and assign that macro to a system command:

[Automation]

SystemStartCommand = <$backup>

[backup]

copy <$$_currpath>\\*.fm x:\\backup

copy <$$_currpath>\\*.fm "y:\\my other\\backup"

Notice the doubled backslashes (required in Mif2Go macros, where backslash is used as an escape character), and the quotes around the path that includes a space. See §28.1.1 Defining macros.

Prompt for values of variables in macros

You can have Mif2Go prompt you for a value each time a System*Command is processed; see §34.5 Supplying run-time values for user variables.

For example, suppose the second back-up location changes frequently. Mif2Go could prompt you for a path name each time a back-up command is executed:

[Automation]

AskForUserVars=Always

SystemStartCommand=<$backup>

[UserVars]

back2=H:\Docfiles\backup2

[UserVarPrompts]

back2=Enter pathname for backup 2:

[backup]

copy <$$_prjpath>\\*.fm x:\\backup

copy <$$_prjpath>\\*.fm <$$back2>

When you start the conversion, Mif2Go prompts you for the value of back2. Your response replaces the initial default value in the configuration file. Next time you run the conversion, the value you supplied last time appears as the initial value.

Comment out commands in macros

To omit running a particular system command without actually deleting the macro line that executes the command, you can “comment out” the command by preceding it with a semicolon. For example, suppose you do not always want to create a second backup:

[backup]

copy <$$_currpath>\\*.fm x:\\backup

; copy <$$_currpath>\\*.fm "y:\\my other\\backup"



34 Automating Mif2Go conversions > 34.4 Executing operating-system commands > 34.4.6 Supplying system commands in a macro