When a particular document is active in HoTMetaL PRO, two sets of macros are available. The default HoTMetaL PRO application macros (which are always available) are in the file Macros/hotmetal.mcr; in addition, if you are using different rules files, each rules file can have a set of rules file-specific-specific macros that are available if a document that uses that rules file is active. For the rules file called rulesname.rls, the macro file will be rulesname.mcr, and it will also be in the Macros folder. If you are using several rules files, you can have a macro file for each one. You can put macros in the default macro file or in a rules file-specific one, as appropriate.
HoTMetaL PRO macro files are XML files with a simple structure. You can edit these files with HoTMetaL PRO or with a text editor.
The entire file is enclosed in <MACROS> and </MACROS> tags. Each macro has the following basic structure:
<MACRO name="MacroName" lang="progid"> ...code... </MACRO>
Many macros also have the key attribute, which specifies the macro's shortcut key. progid is the ProgId of the ActiveX control that implements the scripting language; for example: `JScript', `VBScript', `PerlScript', and `Python'. The language comment string is optional.
<MACRO name="Sample Macro" key="Ctrl+Alt+M" lang="JScript"> // SoftQuad Script Language JSCRIPT: Application.Alert("A typical crazy macro."); </MACRO>
If you associate a macro with a toolbar button (and possibly a menu item) using the HoTMetaL PRO Toolbars... command, other attribute values will be generated automatically.
<MACRO name="Safe Macro" key="Ctrl+Alt+S" lang="JScript"> // SoftQuad Script Language JSCRIPT: <![CDATA[ Selection.PasteString("<Index/>"); Application.Alert("Press <Enter> to dismiss this dialog!"); ]]> </MACRO>
Macros
dialog,
Macros
toolbar, or the Toolbar and Menu Customization
dialog
by setting the optional hide attribute to true. This is
particularly useful for the special event-driven
macros, which are generally not intended to
be run directly by users.
<MACRO name="On_Update_UI" lang="JScript" hide="true"> // ...code... </MACRO>
Copyright © SoftQuad Software Inc. 1999