Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Can I find and replace various characters in a text selection (within Pages) using Apple Script?

I'm a newbie when it comes to Apple Script. I need to replace ordinary white-spaces with non-breaking ones in certain places of a slovak language text in Pages. This should be a workaround for missing localized typography. Could someone help me to create a script for that?


To be more precise: in Slovak language texts (and also in some other languages, like the czech language) prepositions should never be the last ones in a line of paragraph text, but should be bound to the following word. Some programs do honor this convention (like localized versions of MS Office) by automatically putting non-breaking spaces after prepositions. This is a must have if you are trying to write professional texts (like a thesis, or an article).


A possible solution would be to write a script, which would find every possible instance of a preposition with a space, and replace the space with a non-breaking one. This can be done manually using search/replace e.g.: search [space]s[space] replace with [space]s[non-breaking space]. The problem is that there are many prepositions, so if you are trying to do this manually, you have to repeat it for every possible case, which is not a good way.


I have found a macro which does this in LibreOffice (they also don't have an automatic solution for that), but I would like to stay with Pages. 🙂


(A second thought: does Pages support regular expressions?)

Mac OS X (10.7.2)

Posted on May 5, 2012 1:45 AM

Reply
3 replies

Can I find and replace various characters in a text selection (within Pages) using Apple Script?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.