Macros

A macro utility can be used to automate repetitive or boring tasks. Each macro contains a sequence of instructions, such as copying, pasting, editing, choosing menus or responding to dialogues.

To store your instructions you must first switch your macro utility into record mode and then perform each step of the macro manually. Alternatively, your utility may let you create or edit a macro by means of a scripting language. Your completed macro can be replayed at any time and can be assigned a key combination that can be used to activate it.

AppleScript

The most well-known macro application is AppleScript, a powerful system built into modern versions of the Mac OS. It has a recording feature, although this doesn’t work in all applications, and is slow on older Macs and with systems prior to Mac OS 8.5.1. Mastering the AppleScript language isn’t easy, but having done so you can create scripts for a wide range of operations.

Other Utilities

Simpler alternatives to AppleScript include QuicKeys, for both Mac OS X and the Classic Mac OS, and KeyQuencer for the Classic Mac OS. The latter, although daunting to the uninitiated, is quite simple and uses an small amount of memory. It also works with OtherMenu, allowing you to navigate around your folders, even when inside an older form of Open or Save dialogue.

Not all macro editors let you use application-specific key combinations. For example, most KeyQuencer commands are global, meaning that they do the same thing in all applications. Depending on what you want to do, this can be an advantage. However, if you want to use the same keys in various applications you may prefer to use QuicKeys.

  Using Macros to Extend your Keyboard

Some Macs don’t include all the keys provided on a full-size keyboard. Most significant of these are the Home, End and function or F keys. You can add these features to a small keyboard by using a macro to generate a new key code whenever you press a chosen key combination.

Here are some possibilities:-

Required KeyKey Combination
ClearCtrl-Delete
Home-Control-Option-⇡
End-Control-Option-⇣
Page UpOption-⇡
Page DownOption-⇣
F1Ctrl-1
F2Ctrl-2
F9Ctrl-9
F10Ctrl-0

Try to avoid combinations already used in applications, as your macro may not be able to override such shortcuts. You may be able to find a system extension that adds a Forward Delete key function independently of a macro. When installed, your keys should then work as follows:-

Keys PressedEffect
Delete *Backward Delete Character
Shift-DeleteForward Delete Character
Option-DeleteBackward Delete Word
Option-Shift-Delete •Forward Delete Word

* Standard Delete key operation

Provided by Option-Forward Delete on an extended keyboard

  Keyboard Remapping

Each character that appears when you type a key is set by resources contained in the System file. Rather than modify these resources, you can use a macro to generate a substitute key code for each key, a process sometimes known as keyboard remapping.

For example, suppose you want ( to appear when you press the [ key, which can be represented as:-

[ –––> (

Firstly, you’ll need a macro to generate the ( character. With KeyQuencer this consists of:-

Key Shift "9"

Then you assign this macro to the [ key. It’s as simple as that.

Other keys can be changed as required. For example, if your word processor doesn’t support smart quotes you could try the following remapping:-

[ –––> “

] –––> ”

  Text Manipulation

Macros can also be used to manipulate text strings. For example, if you want to extract the month from a date such as:-

07 Jan 97

you could use a macro to generate these keys in sequence:-

-C  -V  Delete  Delete  Delete  ⇠  ⇠  ⇠  Delete  Delete  Delete  ⇢  ⇠  ⇠

leaving you with the cursor correctly positioned at the end of the text containing Jan.

Macros can also be used to twiddle letters, a process that reverses adjacent characters. You can use this to correct typing errors in a word such as head, which can end up as haed. The macro should generate these keys in sequence:-

Shift-⇠  -X  ⇠  -V  ⇢

which of course assumes that the cursor was initially positioned after the pair of letters.

In text documents you may need to change straight quotes into smart quotes. You can do this as a two stage process by means of a text editor controlled by a macro:-

Replace <space>" by “

Replace " by ”

where <space> represents an actual space. Note, however that this doesn’t work properly for quote marks that appear at the beginning of a document or at the beginning of a paragraph.

  Key Assignments

Having chosen a macro utility you’ll need to choose the key combinations for each task. Many people use the function or F keys for these jobs. Unfortunately, older PowerBook computers and other keyboards don’t have these keys, although you can use the Ctrl key in combination with other keys. Fortunately, applications rarely use Ctrl, except for contextual menus. If in doubt, check your applications to see if any spare key combinations are available.

Sometimes it’s difficult to remember which key does what without sticking labels all over your keyboard. To help you memorise the keys you can use a hierarchy of key combinations, as shown in the arrangements below, which are designed for the Classic Mac OS. The first set lets you select commonly-used applications or control panels:-

Keys PressedApplication or control panel
Ctrl-EExtensions Manager
Ctrl-GGraphicConverter
Ctrl-KKeyQuencer Editor
Ctrl-MDOCMaker
Ctrl-VVirus Checker (Virex)
Ctrl-WWorks (ClarisWorks)

Always try to use a letter that relates to the application’s function rather than its name. If you change the application later you won’t need to change the shortcut.

The next set give you access to your Documents folder and folders inside it:-

Keys PressedFolder
Ctrl-Option-DDocuments
Ctrl-Option-FFinance
Ctrl-Option-GGuides
Ctrl-Option-HHard Disk
Ctrl-Option-RResources

whilst the following let you open specific folders in your Applications (Mac OS 9) folder:-

Keys PressedFolder in Applications (Mac OS 9)
Ctrl-Shift-FFile Tools
Ctrl-Shift-GGraphics
Ctrl-Shift-PPrinting Tools
Ctrl-Shift-TFile Translators
Ctrl-Shift-VFile Viewing Software

To remember these, note that the Shift key is just below the A key, and that A stands for Applications.

The last set of combinations give you access to your System Folder and folders inside it:-

Keys PressedFolder in System Folder
Ctrl-Shift-Option-AApple Menu Items
Ctrl-Shift-Option-CCtrl Panels
Ctrl-Shift-Option-EExtensions
Ctrl-Shift-Option-EFonts
Ctrl-Shift-Option-SSystem Folder

With a suitable macro utility you can create a set of special instructions that give you really powerful control over your Mac. The examples shown below work with KeyQuencer. You can of course select your own preferred key combinations.

Keys PressedSpecial Instruction
-Ctrl-Option-AShow About Mac window
-Ctrl-Option-BBalloon Help toggle
-Ctrl-Option-CShow Clipboard
-Ctrl-Option-DRedraw Screen
-Ctrl-Option-FQuit Finder
-Ctrl-Option-QQuit all Applications
-Ctrl-Option-RRestart
-Ctrl-Option-SShut Down
-Ctrl-Option-TShow contents of Trash

Finally, you can use special combinations for opening selected files using alternative applications. For example you may want to open a selected document in ResEdit instead of its normal application or a GIF graphic file in GraphicConverter instead of Internet Explorer. Here are some examples:-

Keys PressedOpen Using:-
-Shift-BBrowser (Internet Explorer)
-Shift-EEditor (Claris Home Page)
-Shift-GGraphicConverter
-Shift-HHexEdit
-Shift-JJPEGView
-Shift-PPictureViewer
-Shift-QQuickTime Player
-Shift-RResEdit
-Shift-TText Editor (BBEdit)
-Shift-WWorks (AppleWorks)
-Shift-VViewer (Help Viewer)
-Shift-XSimpleText

Once again, use a letter that relates to an application’s function rather than its name. Ideally, these should be the same letters as used in the macros that open the applications.

  Text Macros

A text macro utility, such as TypeIt4Me (Riccardo Ettore), automatically replaces typed text by an alternative string of characters that are kept in a special file. This is particularly useful if you hate typing long words. Here are some examples:-

Typed TextResult
fbFred Bloggs
b4before
B4Before
btwnbetween
ysyours sincerely
*ds16/7/01
*dlTuesday, July 16, 2001
*dc10716

You could even enter *addr to produce your entire address, including the necessary carriage returns.

The replacement text isn’t inserted until you type a trigger character, usually a space or the other punctuation normally used at the end of a word. This prevents the expanded text from appearing in the middle of words.

©Ray White 2004.