3 Replies Latest reply: May 5, 2012 1:25 PM by Cattus Thraex
michalmaria Level 1 Level 1

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)