Article View: adobe.scripting.indesign
Article #1212Re: [CS3 JS] Help with script that batch turns layers on and off
From: Dave_Saunders
Date: Sun, 15 Feb 2009 21:41
Date: Sun, 15 Feb 2009 21:41
19 lines
1618 bytes
1618 bytes
You started just fine, but the leap from myFolderContents to myDocument leaves out a few steps. You need to open each document and process it. So you need a loop:
for (var j = 0; myFolderContents.length > j; j++) {
var myDocument = app.open(myFolderContents[j]);
// the rest of your code goes here
}
Now, the only problem you might run into is if the opening of any of these documents throws up a fonts or links issue. Up to you whether you want that to happen or not. If not, you need to manage the interaction level. I'd do this:
for (var j = 0; myFolderContents.length > j; j++) {
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
var myDocument = app.open(myFolderContents[j]);
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
// the rest of your code goes here
}
I know this looks a bit inefficient, but my sense is that you should have neverInteract active for as short a time as possible.
Dave
Technical Details
Message-ID:
<59b7ef63.4@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newshub.sdsu.edu!webcrossingReferences:
<59b7ef63.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,42c96ab71325657f 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!news2.google.com!news.glorb.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Re: [CS3 JS] Help with script that batch turns layers on and off Message-ID: <59b7ef63.4@webcrossing.la2eafNXanI> Date: Sun, 15 Feb 2009 13:41:03 -0800 References: <59b7ef63.-1@webcrossing.la2eafNXanI> Lines: 27 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit