Article View: adobe.scripting.indesign
Article #1438Re: Indesign para2txtframe script problem
From: Dave_Saunders
Date: Sun, 08 Feb 2009 19:20
Date: Sun, 08 Feb 2009 19:20
26 lines
2154 bytes
2154 bytes
You don't say what goes wrong, but it is almost certainly caused by your iterating upwards through the paragraphs. When you move the text of paragraph zero elsewhere, every paragraph in the story shuffles up a position.
Also, you have two iterations through the same paragraphs inside each other, which must also be a cause of a problem or two.
And, "Story" is the name of an object class (in the move statement). You need to be moving to a particular instance of a story (presumabley myTframe.parentStory.
You should close off the for i loop after the grabbing of the contents -- you could also do away with that whole loop and use:
var myParagraphs = myDoc.stories[0].paragraphs.everyItem().contents
Expect that you've used a terribly confusing name for an array of the contents of the paragraphs. Later in the script you completely forget that myParagraphs is an array of strings and try to refer to it as though it were an array of paragraph references. So make it:
var myContents = myDoc.stories[0].paragraphs.everyItem().contents
Now you should use something like:
for (var j = 0; myContents.length > j; j++) {
myTframe = myDoc.textFrames.add({label:'temp' + String(j)});
myParagraphs[0].move(LocationOptions.after, myTframe.parentStory);
}
At least, that's assuming I know what you're trying to do. Your use of the loop inside the loop was doomed to failure because the second time through the story would be empty.
Hope this helps.
Dave
Technical Details
Message-ID:
<59b7d1f3.0@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!newshub.sdsu.edu!webcrossingReferences:
<59b7d1f3.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,da3e0bfe5178684b X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Dave_Saunders@adobeforums.com Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Re: Indesign para2txtframe script problem Message-ID: <59b7d1f3.0@webcrossing.la2eafNXanI> Date: Sun, 8 Feb 2009 11:20:25 -0800 References: <59b7d1f3.-1@webcrossing.la2eafNXanI> Lines: 38 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit