🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #791

Loop actions through several open documents

#791
From: mps
Date: Tue, 03 Mar 2009 20:05
14 lines
1681 bytes
I am on a mac using InDesign CS3. Code is all in Javascript.

Trying to get a loop to work for a series of actions, the purpose is to loop through all the actions for the top document then close that document and proceed to loop through the next, and so on until all are closed.

The problem is that since I am using Data Merge (part of the loop) a new document is created so when the loop is finished the copy is closed but the loop starts on the original document, creating an endless loop.

In other words I have documents "A", "B", and "C" open. Loop performs on A, makes a copy at the Data merge point (call it "A.1") then closes "A.1". At this point I want it to go to "B" but instead we start again with "A" and so on endlessly.

I wrote the following to try to skip the document on top for each cycle through but it doesn't work and I think the logic is flawed.

snippet:
for(myDocumentCounter = app.documents.length; i=0; myDocumentCounter > 0; myDocumentCounter--; i=i++){

Is there another to accomplish this? Maybe, is there a way to have the loop perform on all open documents "at once"?
Technical Details
Message-ID: <59b81a86.-1@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossing

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,3a12f8ba800201a2,start
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: mps@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Loop actions through several open documents
Message-ID: <59b81a86.-1@webcrossing.la2eafNXanI>
Date: Tue, 3 Mar 2009 12:05:39 -0800
Lines: 25
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit