• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Tile and fit all open windows with javascript

Participant ,
Jul 17, 2021 Jul 17, 2021

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");
}
}
Thank you for your insights.
TOPICS
Scripting

Views

207

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Jul 17, 2021 Jul 17, 2021

 

for (var i = 0; i < app.documents.length; i++) {  
    app.documents[i].activate();
    app.executeMenuCommand("fitall");
}

 

Votes

Translate

Translate
Adobe
Participant ,
Jul 17, 2021 Jul 17, 2021

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. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jul 17, 2021 Jul 17, 2021

Copy link to clipboard

Copied

 

for (var i = 0; i < app.documents.length; i++) {  
    app.documents[i].activate();
    app.executeMenuCommand("fitall");
}

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 17, 2021 Jul 17, 2021

Copy link to clipboard

Copied

LATEST

thank you, made my day!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines