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

Looking for Pages script to find "return" "return" and delete 2nd one only

Looking for a Pages Applescript to find "return" "return" and delete 2nd one only. Perform on entire document.


Thanks

Posted on Nov 13, 2011 5:52 PM

Reply
7 replies

Nov 13, 2011 6:25 PM in response to Greg Schneck

Sorry, but it is necessary as I have STYLES on my paragraphs. If I do a normal search and replace, replacing the two with one the PARAGRAPH STYLE is lost! If you have mixed styles the styles get all wrong. Try it and see for yourself. The "style" of a paragraph is "attached" to the "return" and a search and replace on it ruins the style setting. This doc is hundreds of pages and has tons of styles.

Nov 13, 2011 6:56 PM in response to Greg Schneck

I was aware of that. My suggestion was on the off chance you were in the vast majority of people here who do not use styles.


Experiment with inserting a 3rd para or other character, then eliminating the spare elements, to see if you can get past the limitations.


Also try structuring your styles so there is a "Next Style" to every style.


I'm curious as to why you are cleaning your text after styling it? Designers usually make it the first step in layout.


Peter

Nov 13, 2011 7:05 PM in response to PeterBreis0807

I am cleaning the text after styling it because it is a supplied file to me from a customer. I have to prepare it for publication. I had nothing to do with the file creation nor the original styling. So...


I ask again... Does anyone know an Applescript to do what I ask? (or how to globally delete the 2nd return only without losing the Style on the paragraph?)

Nov 13, 2011 7:28 PM in response to Greg Schneck

There is nothing stopping you cleaning the text before opening it in Pages.


The bug with the styling is to my knowledge a Pages bug.


Clean the text elsewhere. The possibilities are TextEdit, Bean and LibreOffice. All free. There are also 3rd party apps like TextSoap.


A bit of advice from a veteran Studio Manager. Most people with a hammer in their hand think that they must use it on everything, including the glassware. Much of my time in studios was getting the staff out of ruts of their own making.


Peter

Nov 14, 2011 2:01 AM in response to Greg Schneck

Funny, the same question was asked on 2011/11/12 in http://macscripter.net/viewtopic.php?id=37477


Nigel Garvey posted a neat answer :


--{code}

tell application "Pages"

delete (paragraphs of front document whose length is 1)

end tell

--{code}


Yvan KOENIG (VALLAURIS, France) lundi 14 janvier 2011 11:01:29

iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2

My iDisk is : <http://public.me.com/koenigyvan>

Please : Search for questions similar to your own before submitting them to the community



Looking for Pages script to find "return" "return" and delete 2nd one only

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