🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #18464

Re: AS. Search and replace text with different paragraph styles

#18464
From: Roy Marshall
Date: Fri, 28 Mar 2003 13:10
40 lines
2963 bytes
Dave you are a star!
I am now getting somewhere with all your help. I do have a problem with the script crashing ID while doing a search. I see you have made comment on other streams, but I have another issue.......

My script is doing a simple find change which isn't crashing (wow) but the script stops with the error "InDesign 2.0.2 got an error: {Text from character 1 to character 4558 of story id 529 of document "Cat in InDesign"} doesn't understand the search message" if I ok the box and run the script again, it will finnish!

do still get a crashing error when i ad further search instances.

I have included the script below:-
tell application "InDesign 2.0.2"
	activate
	set myselection to selection
	set find text of find preferences to "^p^p"
	set change text of change preferences to "^p^p@"
	search myselection with change attributes {changetext:"^p^p#"}
	set find preferences to nothing
	set myAts to search myselection for "@"
	repeat with myCounter from (count of myAts) to 1 by -1
		set myStory to parent story of item myCounter of myAts
		set myIndex to index of item myCounter of myAts
		set myParaIndex to index of paragraph 1 of item myCounter of myAts
		set applied paragraph style of character myParaIndex of myStory to paragraph style "Kidner Headings" of document 1
		delete character myIndex of myStory
	end repeat
	set find text of find preferences to ". "
	set change text of change preferences to ". ^t"
	search myselection with change attributes {changetext:". ^t"}
	set find text of find preferences to " ^t "
	set change text of change preferences to "^t"
	search myselection with change attributes {changetext:"^t"}
	--The next part is the bit that runs on second time
	set find text of find preferences to " �"
	set change text of change preferences to "^t�"
	search myselection with change attributes {changetext:"^t�"}
end tell

I dont know if it would be possible to email you the files to look at at some point? I appreciate you are a busy man (as you seem to be answering everyones probs on here) but it would be useful

Many Thanks

Roy
Technical Details
Message-ID: <1de8743a.5@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de8743a.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f939a,84b62141db21aa59
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-03-28 05:37:41 PST
From: "Roy Marshall" <royston_marshall@hotmail.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: AS. Search and replace text with different paragraph styles
Message-ID: <1de8743a.5@WebX.la2eafNXanI>
Date: Fri, 28 Mar 2003 05:10:15 -0800
References: <1de8743a.-1@WebX.la2eafNXanI>
Lines: 49
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit