AppleScript Notes

Application Keywords in Applescript

A modest solution would be to improve AS’s pretty printer so it
uses different styles to distinguish between commands, properties,
elements, types and enums, rather than using a single style for all
as it currently does. If anyone wants to file a feature request to
that effect then be my guest.

Something you can do right now (thank you for the perfect segue) is
to change the style for application keywords to be underlined.
Because it will also underline the space, you can tell, for example,
that “path to” is a single term, while “path of” is two. (I did this
a while ago while tracking down a terminology bug, and discovered it
was generally useful.) However, has’ idea is still a good one.

–Chris Nebel
AppleScript and Automator Engineering

[1] How to do it:

0. Quit Script Editor.

1. Open ~/Library/Preferences/ It should
have an AppleScriptTextStyles entry. If not, see 1a.
1a. Change one of the styles somehow (color, font…), quit Script
Editor, relaunch it, put it back, quit again, and go back to step 1.

2. AppleScriptTextStyles is an array of entries in the same order
they’re listed in the preferences; “application keywords” is the
fourth one. (Index 3, since they start at zero.)

3. Each entry is a string formatted as “fontname;style;size;RGB
color”. The default for application keywords is “Verdana;p;12;0 0
65535”, in other words, 12 point plain Verdana in blue. “p” for the
style means “plain”; change it to “u” for “underline”. (You could
also add “b” for bold or “i” for italic if you felt like it.)

4. Save and close the file.