How to use KM to change font color in Keynote?

I use Keynote a lot and I am getting tired of the tedious way required to change the color of text:

  1. First you have to select the text (naturally)
  2. Then you have to activate the color box (lame repetitive, annoying step)
  3. Then, you have to choose from a teeny tiny color swatch if you want the same orange every time.
  4. Then, if you click on another object you have to re-activate the color box again in order to change text color.

Ugh.

Is there a way that I can get KM to do some of these steps. I would love to be able to select text and fire one action that changes the text to the exact orange I want. Another for white. Etc.

I am not proficient on all that KM has to offer, so what I am really asking is how to approach this challenge with the glory and beauty of KM at my side.

Eager to learn, thanks so much!

Just a +1 bump to this topic.
Exactly what I’ve been searching for.
there are some tips on macosautomation site for highlighting, red strikethrough etc, but can’t get them to work.

any help much appreciated.

SC

Hi,

The following AppleScript will set up a Keynote presentation with a title & subtitle slide followed by a blank side with a text item. While you can style the font, size and colour it appears that you can’t do much else. I found iWork Automation very helpful.

tell application "Keynote"
activate
set thisDocument to make new document with properties {document theme:theme "Black"}

tell thisDocument
	set the base slide of the first slide to master slide "Title & Subtitle"
	set documentHeight to its height
	
	tell first slide
		set the object text of the default title item to "Keyboard Maestro"
		set the object text of the default body item to "Subtitle"
	end tell
	set thisSlide to make new slide with properties {base slide:master slide "Blank"}
	tell thisSlide
		set thisDisplayText to "Keyboard Maestro"
		set thisTextItem to ¬
			make new text item with properties {object text:thisDisplayText}
		tell thisTextItem
			-- set type size
			set the size of its object text to 72
			set the color of its object text to {12000, 22000, 32000}
			-- set typeface
			set the font of its object text to "Zapfino"
			-- adjust its vertical positon
			copy its position to {currentHorizontal, currentVertical}
			set its position to {currentHorizontal, documentHeight div 3}
		end tell
	end tell
end tell

end tell

It seems that the scripting in Keynote is fairly limited. And things like highlighting and strikethrough seem not to be possible. Setting opacity and reflection are supported.

P.S. I find Script Debugger really helpful for its dictionary functionality when looking at things like this.

Karen

Thanks Karen!

I just got Script Debugger and it sure is powerful! Can’t imagine going back to Script Editor! Eecch!

I have learning a lot from your post and appreciate you taking the time to share it. I am getting close to being able to actually accomplish this via AppleScript. I am really liking that scripting is getting me to finally use Keyboard Maestro! I have owned it forever, but just haven’t learned it well, until now.

Thanks for the help!

Bodie

2 Likes

With AppleScript I haven’t found a way to get the active (selected) text item.

But you can try this:

[test] Change Color of Text Selection.kmmacros (2.5 KB)

It copies the selected text to the clipboard, changes the color and pastes it back.

###Note:

With my iWork apps this works only if an entire paragraph is selected, whereas with other apps it works for any text selection.