Work with Connexion client macros
Find out how to view, edit, run, stop, and delete macros in Connexion client.
View or edit macros
- Navigate to Tools > Macros > Manage. The Macro window opens.
- Under the Macros list, click the plus sign (+) next to the macro book that contains the macro you want to edit.
- Select the macro and click Edit.
- In the OCLC Connexion Macro Editor and Debugger window, edit the macro and then follow steps 9 through 11 for writing a macro.
Include macros in another macro
Including macros in a macro lets you:
- Reuse macros you developed and tested as building blocks for more complex macros.
- Insert standardized elements in multiple macros (for example, declarations of variables, frequently used subroutines, or a function library).
- Avoid the errors and repetitive debugging that result from recreating existing code.
You can:
- Run a macro from another macro:
- The RunMacro command executes a specified macro from within another macro. When the called macro finishes running, execution of the calling macro resumes with the next statement.
- Syntax: BOOL = CS.RunMacro(“macrobook!macroname”)
- Tip: For faster execution, locate macro(s) you run using the RunMacro command in the same macro book that contains the calling macro(s).
- Limitation: RunMacro does not include code from the specified macro in the compile process. The called macro is treated as an external “black box.”
- The RunMacro command executes a specified macro from within another macro. When the called macro finishes running, execution of the calling macro resumes with the next statement.
- Include code from another macro in compile:
- The $Include metacommand tells the OML compiler to merge code from another macro at compile time. Included code becomes part of the macro that contains the $Include command. Functions, subroutines, and variables in the included code become available for use at any time during the main macro's execution.
- Syntax: $Include: “macrobook!macroname”
- Correct: The topic describing $Include in OML Standard Basic Language Reference Help gives the syntax for including a file by specifying path (drive and folder) and file name. This syntax does not work in client macros. You must specify the macro to include as “macrobook!macroname”.
- Tip: Place the $Include metacommand before the main procedure (Sub Main() ... End Sub) of the macro if the code to be included contains global components such as declared variables, functions, or subroutines.
Run macros
- Navigate to Tools > Macros > Manage. The Macro window opens.
- Under the Macros list, click the plus sign (+) next to the macro book that contains the macro you want to run.
- Select the macro.
- Click Run.
You can also run a macro by assigning and using a keystroke shortcut or by assigning a user tool button and adding it to the toolbar. See Work with keystroke shortcuts and Assign custom user tools for more information.
Stop macros
To stop a macro from running, navigate to Tools > Macros > Stop or press <Ctrl><Alt><Shift><T>.
Delete macros
- Navigate to Tools > Macros > Manage. The Macro window opens.
- Under the Macros list, click the plus sign (+) next to the macro book that contains the macro you want to delete.
- Select the macro you want to delete.
- Click Delete.
- Click Yes to confirm or No to cancel.
Tips for using the Macro Editor
- Description - Provide an informative description for each macro you create.
- Comments - Include comments in the macro to document what each part of the macro does. Comment lines begin with a single quotation mark (').
- Open and work with multiple macros
- To open another Connexion client macro, with the Macro Editor open:
- Navigate to Tools > Macros. The Macros window reopens.
- Select another macro in the list or create a new one and select it.
- Click Edit. The macro opens in the OCLC Connexion Macro Editor and Debugger window opens.
- To help navigate among multiple open macros in the Editor:
- On the OCLC Connexion Macro Editor and Debugger window menu, click Cascade or Tile, or make a different macro window current (bring it to the top and set focus) by selecting its name in the windows list.
- To open another Connexion client macro, with the Macro Editor open:
- Help for BASIC keywords - To get a specific Help topic on any BASIC language keyword (e.g., sub) in a macro in the Editor, right-click the keyword in the macro text.
- Reference table - For diacritics and special characters in data used with macro commands such as CS.GetField or CS.SetField, see ASCII and hexadecimal codes for diacritics and special characters.