Article View: adobe.scripting.indesign
Article #15108Re: Painfully Slow Text Operations
From: Dave_Saunders
Date: Sat, 27 Dec 2003 13:10
Date: Sat, 27 Dec 2003 13:10
40 lines
2002 bytes
2002 bytes
My script is attempting to convert the tables to text and then to format them. I tried this:
//Convert tables to text.
myTables = myStory.tables;
theLim = myTables.length;
for (i=theLim - 1; i> -1; i--) {
myText = myTables[i].convertToText();
myText.appliedParagraphStyle = app.documents[0].paragraphStyles.item('--PDStemp');
}
The attempt to set the applied paragraph style takes minutes. Aha, I thought, perhaps I can use a completely different technique, so I tried this:
//Convert tables to text.
myTables = myStory.tables;
theLim = myTables.length;
myTempStyle = app.documents[0].paragraphStyles.item('--PDStemp');
for (i=theLim - 1; i> -1; i--) {
myText = myTables[i].convertToText();
app.findPreferences = null;
app.changePreferences = null;
myText.search(undefined,false,false,undefined,undefined,{appliedParagraphStyle:myTempStyle});
}
And while I didn't whip out a stop watch, it seemed to take the same amount of time. It looks to me that it is use of the myText variable with its reference near the end of this longish story that is causing the problem.
Thing is, this is just a sample. the real data has 46,000 tables. Gulp!
Time for some lateral thinking. However, this slowness does seem to be a real problem for InDesign CS scripting -- at least with JavaScript. I've not checked AppleScript.
Dave
Technical Details
Message-ID:
<2ccf16e7.0@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webxReferences:
<2ccf16e7.-1@webx.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,1d2548d78225dca4 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-12-27 05:37:32 PST From: Dave_Saunders@adobeforums.com Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: Re: Painfully Slow Text Operations Message-ID: <2ccf16e7.0@webx.la2eafNXanI> Date: Sat, 27 Dec 2003 05:10:11 -0800 References: <2ccf16e7.-1@webx.la2eafNXanI> Lines: 50 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit