tell application "Keynote"
	activate
	tell the front document
		set replaceKeys to {%@}
		set replaceValues to {%@}
		repeat with aSlide in slides
			repeat with aItem in text items of aSlide
				set fieldString to object text of aItem
				if fieldString contains "<$" then
					set x to 1
					repeat with key in replaceKeys
						set replaceValue to item x in replaceValues
						set the fieldString to my replace_chars(fieldString, key, replaceValue)
						set x to x + 1
					end repeat
					set the object text of aItem to fieldString as string
				end if
			end repeat
		end repeat
		save
	end tell
	tell front document to save
end tell


on replace_chars(this_text, search_string, replacement_string)
	set AppleScript's text item delimiters to the search_string
	set the item_list to every text item of this_text
	set AppleScript's text item delimiters to the replacement_string
	set this_text to the item_list as string
	set AppleScript's text item delimiters to ""
	return this_text
end replace_chars
