I am working on a utility for InDesign CS. This utility will allow the user to automate multiple search/replace commands. The purpose being to clean up supplied text files (removing multipe spaces, multiple returns, etc.). I would like to display a small black triangle as an indication of a space character. Lucida Grande has such a character and since that’s what I’m using in my text boxes I have defined a variable, SpaceChar with the appropriate Unicode information. The handler below works fine IF the first character input is a space. It doesn’t work other than that. :rolleyes:
How can I have a space character replaced anywhere in the text, on the fly?
property SpaceChar : «data utxt25b4»
on keyboard up theObject event theEvent -- called by text fields SearchText and ReplaceText
if characters of theEvent = " " then
set theContents to the content of theObject
if length of theContents > 1 then
set theContents to characters 1 thru -2 of theContents & SpaceChar as text
else
set theContents to SpaceChar
end if
set the content of theObject to theContents
end if
end keyboard up
Thanks in advance,
Brad Bumgarner, CTA