Macros: how to create and use

Author: smoody
Posted in: Systems

Macros allow you to save text and commands into function keys and reuse them at will.

You can use the twelve function keys alone or with Ctrl, Alt, or Shift, giving you almost 48 macros to work with. (Some combinations aren’t available, so the total is not quite 48.)
It’s easy to create text macros that simply type the same information again and again, such as “Check for map in back pocket”. Command macros, which use non-text keys like Tab, Control, Alt, and Enter, are harder to create and have some limitations.

Relevant Innovative manual pages (for reference):

Basic steps to create a macro:

1. Click Admin > Settings.
2. Click Macros (see the illustration).

3. Select one of the four tabs: No Modifier, ALT, CTRL, or SHIFT.

4. In the box next to the function key you want to define, enter the text you want the function key to insert. (Tip: You can copy text out of an existing record, an email message, or any other available text, and then paste it in with Ctrl+V.)

5. Click Save Settings, then click OK.

Test your macro by going to the screen where you want to insert your text. Place the cursor exactly where you want the text to start, and press the function key you just defined. The system should insert the text you defined for that function key, exactly as if you had typed it directly.

Command macros

A macro can simulate the press of special keys like Enter or Tab, or key combinations such as Alt+Q or Ctrl+I, if you use the following rules:

  • The special key must be in all caps and must be surrounded by percent signs, like this: %ENTER% (for the Enter key)
  • Key combinations must be surrounded by percent signs and use a plus sign to link the keys, like this: %CTRL+i% (for Ctrl+I)
  • Only the following keys can be simulated:
Keyboard Code Corresponding Key Combination
%HOME% Home
%END% End
%LEFT% LeftArrow
%RIGHT% RightArrow
%UP% UpArrow
%DOWN% DownArrow
%TAB% Tab
%PGUP% Page Up
%PGDOWN% Page Down
%ENTER% Enter
%ALT+<another key>% ALT+<another key>
%CTRL+<another key>% CTRL+<another key>
%SHIFT+<another key>% SHIFT+<another key>

and combinations of ALT, CTRL, SHIFT with another key

Macros Tutorial 1: Text Macros

In this tutorial, we’ll create a macro that types in the text “Check for map in pocket” when you press Shift+F1.

  1. Log into the training server.
  2. In the Millennium main window, click Admin > Settings.
  3. In the next window, click the Macros tab.
  4. Click the Shift tab.
  5. Click the box next to “F1”. (If that box already has a macro in it, choose an empty box and use it for the rest of the tutorial.)
  6. Type in the box: Check for map in pocket.
  7. Click OK. (The macros window disappears, and you’re returned to the main window.)
  8. Open any item record for editing. (If you don’t usually edit item records, pick another record type. Don’t worry if adding “Check for map in pocket” doesn’t make sense for the record you choose.)
  9. Click the Insert icon or press Ctrl+I.
  10. Choose Message from the list of fields (if you’re not editing an item record, choose any field; if it’s a MARC field, enter MARC tags and indicators as necessary).
  11. Press Shift+F1.
  12. Click OK.
  13. Examine the record to see if the field was entered properly.
  14. Save the record. (Be sure you’re on the training server!)

Macros Tutorial 2 Command Macros

Command macros contain keys that do more than just enter text. For instance, a command macro could insert a new field, or save a record.
Command macros are simply lists of keyboard commands, so in order to create them you need to have a good understanding of how to use the keyboard to navigate Millennium and edit records.
Test your knowledge of keyboard commands with this little quiz. How many of these actions can be done with the keyboard only?

  1. Change modes (for instance, move from Circulation Desk to Search/Holds in MilCirc
  2. Move from one fixed field to the next
  3. Select (highlight) the word currently under the cursor
  4. Select from the current cursor position to the end of the field
  5. Copy and paste selected text
  6. Delete a variable field
  7. Insert a new variable field
  8. Save the current record
  9. Close the current record
  10. Close the current record and display the next one (in a browse)

The answer is: all of them.
If you want to see how, visit this page: Keyboard Shortcut Quiz Answers

If you know how to do at least some of these things with the keyboard, then you’re ready to become an expert macro writer. You can go on right away to creating command macros: Macros Tutorial 3: Your First Command Macro
If you’re unfamiliar with keyboard shortcuts, or if you’d like a review, go to this page: Millennium Client Keyboard Shortcuts and then return to this tutorial.

Macros Tutorial 3 Your First Command Macro

In this tutorial, we’ll create a macro that opens the Settings window when you press Shift+F2.

  1. Log into the training server (if you’re not already logged in).
  2. In the Millennium main window, click Admin > Settings.
  3. In the next window, click the Macros tab.
  4. Click the Shift tab.
  5. Click the box next to “F2”. (If that box already has a macro in it, choose an empty box.)
  6. Type in the box: %ALT+a%t Be very careful to type this exactly. The percent signs, plus sign, and uppercase “ALT” are all important. If you want, you can copy (Ctrl+C) this:%ALT+a%t

and paste (Ctrl+V) it into the Millennium Client.

  • Click OK. (The macros window disappears, and you’re returned to the main window.)

Now press Shift+F2 (or the other key combination you chose if you chose another). The Settings window opens.
Congratulations! You’ve just created your first command macro. Now you can use your function key to open the Settings window in the rest of the tutorial.

Macros Tutorial 4 Another Command Macro

Let’s say you have a stack of books, and you need to update the Price field in each item record. Typically, you would use three devices — scanner, mouse, and keyboard to do this. We can eliminate the mouse steps with a macro.
To create a macro for this, we need to analyze the activity and determine a keystroke for each step.
This is where things get interesting. Although scanning the same barcode always retrieves the same item record, the view that you see after scanning depends on which Millennium module you are in (Cat, Circ, Acq, Ser) and the choice you have made (if any) within View > Record View Properties.
For the purpose of this tutorial, we’ll assume that scanning a barcode opens the Summary of Attached Records, and that you need to open the Record tab to edit the item. (If scanning a barcode brings you straight to the editing screen, you can save one step in your macro.)
The sequence of steps (including the analysis) is:

  1. Scan the barcode; get the Summary screen.
  2. Move to the Record tab. Ctrl+T does this. (See
  3. Move to the Price field. A succession of Tabs will do this. How many? It turns out to be nine. You just have to try it and count.

Here is the macro version, separated into three steps, corresponding to the analysis.

  1. Scanning isn’t part of the macro proper, but the steps necessary to get to the screen where the macro starts — and, if necessary, to position the cursor properly — should always be part of the macro planning and part of the documentation.
  2. %CTRL+t%

Now let’s create the macro in the training server.

  1. Display the Settings window. (Remember you have a macro for this!)
  2. Choose the Macros tab.
  3. Choose an available function key. (Remember which one you chose!)
  4. In that box, enter %CTRL+t%. (An easy way to do this, aside from copying and pasting from this screen, is to right-click on the empty box and choose CTRL from the drop-down list. Then insert “t” before the final percent sign.)
  5. Choose a second available function key. (Remember this one too!)
  6. In that box, enter nine times. This means 18 percent signs, two for each TAB. (There are several ways to make this easier, aside from copying and pasting from this screen. You can right-click and choose TAB from the drop-down list nine times. Or you can do that once, copy the inserted text once, and then paste eight times.)
  7. Click OK.

Now test your macros.

  1. Scan a barcode, then press your first function key. You should see the record open, reading for editing.
  2. Press your second function key. You should see the Price field highlighted, ready to be changed.

Did everything work OK? Whether it did or not, read on.
Why did we create two macros? Couldn’t we have put the entire set of commands into one function key?
Yes, we could have — but there’s a good reason for breaking up a macro into sections, particularly when you’re first working it out.

  • What if it didn’t work? How would we know which step had failed?
  • What if it worked … but worked wrong? What if we had included commands for making changes and saving them, and we messed up the record irreversibly?

If you create your macro as a series of short steps, it’s easier to find problems and fix them. Once you’re sure that the individual steps work, you can combine them (remember copy-and-paste!) into a single function key.
This concludes the tutorial.
You will probably want to look at these additional pages about macros:

And here are some possibilities for additional practice:

  • If the macro you created in this lesson didn’t work properly, try to figure out why. Did you make any typos? Do you have enough percent signs? Did you press the right function keys in the right sequence?
  • Combine the two macros in this lesson into a single function key.
  • Create a macro that updates the price to $274.95, then saves and closes the record. (Is it better to save and then close, or close and respond to the prompt to save?)

Macros: Tips, Tricks, and Traps

No jumping between windows

A macro can open a new window, but it can’t act on that window. For instance, if you want a macro to insert a new field in a record using CTRL+i, you can place the command %CTRL+i%, and it will open the Insert-a-field window
and then stop.
A macro can’t span two windows, so if you wanted to create the field with macros, you’d need at least two: one to open the Insert-a-field window, and a second one to insert the text you want, once the window is open.
(Or you could take advantage of the fact that you can add a new field without opening a new window, by using the Enter key while the cursor is in the variable field area. It always pays to think outside the box.)

Saving macros (short-term vs. long-term)

If you want to use a macro only for your current login session, just click OK after defining the macro. You can use the macro while you remain logged in, but when you log out the slot in the Macros definition window will be emptied.
To save macros for long-term use, click Save Settings, then click OK. The macro will be available permanently (until you change or delete it).

Sharing macros

Macros are created, edited, and stored in each login separately, which means that there’s no way to create a macro that’s automatically available to everyone. The best way to share macros is to share them outside Millennium (send them in an email message, post them on a wiki, etc.) and have everyone copy-and-paste them into their own Macros window.

Macros in student logins

Students can access the Settings menu to create and edit macros, but they don’t have the ability to save macros for future logins. Supervisors who want to save macros in student logins need to do this:

  • Log in using the student login.
  • When prompted for initials and password, enter your own initials and password. You may not know these, since you are not prompted for them when you use your own login. If you don’t know what they are, ask the OskiCat help desk.
  • Go to Admin > Settings and modify the macros as you wish.
  • Click Save Settings, then click OK.
  • Either log out, or click Admin > Clear Initials, so that your permissions don’t remain active.
  • The students will now be able to use the macros you want them to have.

    Suggestions for Useful Macros

    • Automate commands you use frequently
      • View > Public Display
    • Automate text that you use frequently (particularly if it’s hard to type)
      • Your email address (useful for setting up “Send to email address”)
    • Simplify awkward keystrokes
      • Ctrl+Shift+E (Edit Patron Record, Edit Bib Record)

    Keyboard Shortcut Quiz Answers

    Answers to quiz on Macros Tutorial2 Command Macros

    1. Alt+G (the Go menu)
    2. Tab (forwards) or Shift+Tab (backwards)
    3. Ctrl+ArrowLeft, then Ctrl+Shift+ArrowRight
    4. Shift+End
    5. Ctrl+C (Copy), then Ctrl+V (Paste)
    6. Ctrl+D
    7. Ctrl+I
    8. Ctrl+S
    9. Alt+Q
    10. Ctrl+] (i.e., Control+Bracket)

    Legacy Data

    Last updated date: 10/20/11
    Author: P. Youngholm
    Responsible for Updates: Systems

    Archived Comments

    To do:
    Fri, 04/01/2011 – 09:18 — Charis Takaro
    Images need to be “harvested” and manual links fixed before source content can be taken down. Also, link to this page from macros section. -Charis

    Created: April 27, 2016
    Last revised: November 30, 2016
    Review date: None set

    Leave a comment

    Your email address will not be published. Required fields are marked *