Customizing Pages ’09: Writing centuries in French

Posted by Pierre Igot in: Pages
April 8th, 2010 • 10:22 am

The proper way to write something like “20th Century” in French is the following:

xxe siècle

where “xx” is the number in roman numerals in small caps and “e” is a small superscript “e.”

As you can imagine, if you have write this type of thing repeatedly in a text, it can quickly become pretty tedious.

An automatic text entry tool such as Spell Catcher X, which I use all the time, is only partially helpful here, since it can only enter the characters and not apply the required character formatting options.

For that, you need a script/macro that automates the process. There is probably a way to do this in AppleScript for Pages ’09, but as a user of Keyboard Maestro, I find it easier to just create the whole macro using that tool. It also makes it easier to adapt the macro for another word processor, such as Microsoft Word.

The Keyboard Maestro macro I created for entering “20th Century” in French in a Pages document is the following:

Keyboard Maestro - 20th Century

It uses Keyboard Maestro’s ability to automatically detect specific strings in what you are typing and trigger a macro when it detects a specific string. In this case, it detects when I type “20s ” (that’s 20sSpace) in Pages and then automatically deletes what I have just typed and replaces it with “xxe siècle.”

After that, it uses text navigation and selection shortcuts to select “xx” and “e” and apply the required formatting to them.

And finally it puts the cursor back at the end and insert a space.

This way, “20s” behaves like a glossary entry would in Spell Catcher X. The only difference is that, in addition to automatically inserting the text, it also applies the required formatting.

Of course, there are at least 21 different centuries that one might need to refer to, so I had to create 21 different Keyboard Maestro macros, one for each century. It’s fairly easy to do, since you can use the “Duplicate” command in Keyboard Maestro’s “Edit” menu to duplicate an existing macro and then just edit it as required.

Roman numerals being what they are, you will need to adjust not only the string of text that is automatically entered, but also the exact number of right arrow keystrokes required to select the number, depending on the number of characters in the century number. (For the first century, you will also need to use a superscript “er” instead of just “e.”)

It’s a bit repetitive, but once it’s done, it’s done and you can now easily enter centuries in Pages ’09 without having to repeat all the required steps each and every time.

I have thus defined 21 macros using respectively the abbreviations “1s ,” “2s ,” “3s ,” and so on.

The same macro can also easily be adapted for Microsoft Word. You’ll just need to adjust the text navigation shortcuts, because for some reason Word requires an extra OptionRight at the end to bring the cursor back where you want it.

With Keyboard Maestro, you can use the same abbreviations for both sets of macros and just specify which application the macro triggers apply to.

I am also using a similar scheme to automate the entry of the French equivalents of “Grade 1,” “Grade 2,” “Grade 3,” etc. In French, “Grade 12“, for example, will be:

12e année

Here again, a superscript “e” is required and it’s tedious to have to do it manually. I now have macros using the abbreviations “1a ,” “2a ,” “3a ,” and so on to automatically enter grade levels in French in my Pages documents.

And that’s a good thing.


Comments are closed.