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

Script to rearrange all artboards?

Contributor ,
Jul 25, 2024 Jul 25, 2024

Copy link to clipboard

Copied

Hi everyone,

I was wondering if anyone has a script to rearrange all arboards in a document? I know there's a feature for that in Illustrator, but I intent to "merge" it with another code that I am currently working on. The script should follow the specs below:
- Layout - Grid by Row, Order - Left-to-Right,
- 4 columns, spacing 20 pt
- Move Artwork with Artboard

Rogerio5C09_0-1721919899053.png

Thanks in advance,
Rogerio

TOPICS
Scripting

Views

238

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
Adobe
Enthusiast ,
Jul 25, 2024 Jul 25, 2024

Copy link to clipboard

Copied

Of course it is possible to write a script, but there are many problems with moving artboards: calculating the correct coordinates, moving hidden or locked objects, moving objects with transparency masks.

I would also suggest to think about an alternative solution. Call a native rearrange window inside the script where you can enter values manually. Yes, it will take time, but this native command is free of scripting problems.

 

(function () {
  // .. do something
  app.executeMenuCommand("ReArrange Artboards");
  // .. do something
})();

 

 

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
Contributor ,
Jul 26, 2024 Jul 26, 2024

Copy link to clipboard

Copied

Hi @Sergey Osokin, thanks for checking! 🙂

I found some guidance on this link and was able to code it - adding here just in case anyone need:

doc.rearrangeArtboards(DocumentArtboardLayout.GridByRow , 4 , 20 , true);

Best,

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
Enthusiast ,
Jul 26, 2024 Jul 26, 2024

Copy link to clipboard

Copied

LATEST

You're right. I've never needed this feature, so I didn't think to look at the Object Model Viewer.

 

<method name="rearrangeArtboards">
  <shortdesc>Rearrange Artboards in the document.</shortdesc>
  <parameters>
    <parameter name="artboardLayout" optional="true">
      <shortdesc>Layout of artboards for rearrangement.</shortdesc>
      <datatype>
        <type href="#/DocumentArtboardLayout">DocumentArtboardLayout</type>
        <value>DocumentArtboardLayout.GridByRow</value>
      </datatype>
    </parameter>
    <parameter name="artboardRowsOrCols" optional="true">
      <shortdesc>Number of rows (for rows layout) OR column(for column layouts)of artboards.Range is 1 to (docNumArtboards - 1) or 1 for single row or column layouts.</shortdesc>
      <datatype>
        <type href="#/Int32">Int32</type>
        <value>1</value>
      </datatype>
    </parameter>
    <parameter name="artboardSpacing" optional="true">
      <shortdesc>Spacing between artboards.</shortdesc>
      <datatype>
        <type>number</type>
        <value>20.0</value>
      </datatype>
    </parameter>
    <parameter name="artboardMoveArtwork" optional="true">
      <shortdesc>Whether to move artwork with artboards.</shortdesc>
      <datatype>
        <type>bool</type>
        <value>true</value>
      </datatype>
    </parameter>
  </parameters>
  <datatype>
    <type>bool</type>
  </datatype>
</method>

 

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