Copy link to clipboard
Copied
Hi, new to ai scripting.
Trying to tile a bunch of open ai documents and have all their view set to Tile and then Fit all in Window or Fil Artboard in Window.
The code below only works on 1 window, how do i looped the filall in all open docs?
for (var i = app.documents.length-1; i >= 0; i--) {
var doc = app.documents[i];
{
app.documents.arrange(DocumentLayoutStyle.VERTICALTILE);
app.executeMenuCommand("fitall");
}
}
for (var i = 0; i < app.documents.length; i++) {
app.documents[i].activate();
app.executeMenuCommand("fitall");
}
Copy link to clipboard
Copied
The Tile command only need to run once, so that works
I think the problem is that you can't iterate
app.executeMenuCommand("fitall");
I tried doc.executeMenuCommand('fitall"); it didn't work.
Apology for the typo in my first post, can't edit it.
Copy link to clipboard
Copied
for (var i = 0; i < app.documents.length; i++) {
app.documents[i].activate();
app.executeMenuCommand("fitall");
}
Copy link to clipboard
Copied
thank you, made my day!