how to run the javascript in all active indesign documents?
Hello all,
Newie here. I browsed through the different forums and assembled a simple script to set up the column and gutter on an indesign page, It's not this simple, it will be expanded later.
var doc = app.activeDocument;
var page = doc.pages.item(0);
page.marginPreferences.properties = {
columnCount: 12,
columnGutter: 0
};
it works when run via Indesign script menu on the active document. I would like it so that it runs on all open documents. I googled far and wide, and found some sample, but i could not make it work, either syntax errors, var undefined, etc.
I tried the suggestion from how to apply my script to all opened files?, it didn't work.
It didn't work for me.
while (documents.length > 0) {
var doc = app.activeDocument;
var page = doc.pages.item(0);
page.marginPreferences.properties = {
columnCount: 12,
columnGutter: 0
}
app.activeDocument.close()
}
I tried copying from another script that Mr. Kuhrel helped me with prior, it still runs but only on the active window.
The variables are not correct, that much i can tell but i don't know how to fix it.
for (var i = app.documents.length-1; i >= 0; i--) {
var doc = app.activeDocument;
var page = doc.pages.item(0);
page.marginPreferences.properties = {
columnCount: 3,
columnGutter: 0
}
}
Is there a universal wrapper that can be used to //insert codes here — to run on all open documents in indesign?
Regards and have a great weekend.
