Question

I am using TextEdit, and I am frequently switching between red, blue and black for the text colour. Right now I have to move my mouse to the colour picker in the toolbar and select the desired colour.

Is there a way for me to press a key combination to switch between them instead?

Was it helpful?

Solution

There are two ways that I can think of:

One involves running an apple script and mapping keys, which is difficult depending on your skill level, it is described in this post:

http://macscripter.net/viewtopic.php?id=19711

The script requires that you have support for assistive services enabled, which I had to do. This can be found at: /Applications/System Preferences/Accessibility/ enter image description here

I've extracted the script here.

All you need to do is save the three files changing one line:
activate application "TextEdit"
tell application "System Events" to tell text area 1 of scroll area 1 of window 1 of process "TextEdit" to if exists then
    set {x, y} to value of attribute "AXSelectedTextRange"
    if x ≤ y then tell application "TextEdit" to set color of document 1's characters x thru y to {0, 0, 0}
end if

All you need to do is copy the above text and then save it as a file called "black (or whatever you want).scpt" For changes to Blue you need to change the second to last line to:

{0, 0, 65535}

For Red; and

{65535, 0, 0}

For Black just use the one I posted above.

Then you will need to assign the AppleScript files to a keyboard shortcut via Automator, although there are third party tools that make this easy.

The other uses the shortcut: Command + shift + T and having the three colours already defined in the boxes below. I assume you are already doing this? And it does not really qualify as keyboard shortcuts.

Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top