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

Creating new document, rows & columns

Participant ,
May 03, 2017 May 03, 2017

Here is a function from a script that creates a new document... simple right?

I was expecting the function to generate a new document with 50 artboards with 10 columns? Instead, the number of columns is getting set to whatever value is currently saved in the new document "Columns" property?

Curious if anyone is able to run this code, and set the number of columns by changing the "artboardRowsOrCols" value?

Thanks!

Scott

Header 1

test();

function test(){

  var newDocPresets = new DocumentPreset;

        newDocPresets.title = "test";

        newDocPresets.colorMode = DocumentColorSpace.RGB;

        newDocPresets.units = RulerUnits.Pixels;      

        newDocPresets.width = 40;

        newDocPresets.height = 40;

        newDocPresets.numArtboards = 50;

        newDocPresets.artboardLayout = DocumentArtboardLayout.GridByRow;

        newDocPresets.artboardRowsOrCols = 10;       // this value is not getting set

        newDocPresets.artboardSpacing = 30;

      

  var newDoc = app.documents.addDocument( "Basic RGB", newDocPresets );

}

TOPICS
Scripting
1.5K
Translate
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

Community Expert , May 03, 2017 May 03, 2017

Hi @scottRaysNI,

one possible way

test();

function test() {

    var newDocPresets = new DocumentPreset;

    newDocPresets.title = "test";

    newDocPresets.colorMode = DocumentColorSpace.RGB;

    newDocPresets.units = RulerUnits.Pixels;     

    newDocPresets.width = 40;

    newDocPresets.height = 40;

    newDocPresets.numArtboards = 50;

    //newDocPresets.artboardLayout = DocumentArtboardLayout.GridByRow;

    //newDocPresets.artboardRowsOrCols = 10;       // this value is not getting set

    //newDocPrese

...
Translate
Adobe
Community Expert ,
May 03, 2017 May 03, 2017

Hi @scottRaysNI,

one possible way

test();

function test() {

    var newDocPresets = new DocumentPreset;

    newDocPresets.title = "test";

    newDocPresets.colorMode = DocumentColorSpace.RGB;

    newDocPresets.units = RulerUnits.Pixels;     

    newDocPresets.width = 40;

    newDocPresets.height = 40;

    newDocPresets.numArtboards = 50;

    //newDocPresets.artboardLayout = DocumentArtboardLayout.GridByRow;

    //newDocPresets.artboardRowsOrCols = 10;       // this value is not getting set

    //newDocPresets.artboardSpacing = 30;

    var newDoc = app.documents.addDocument( "Basic RGB", newDocPresets );

    newDoc.rearrangeArtboards(DocumentArtboardLayout.GridByRow , 10 , 30 , true);

}

Have fun

Translate
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 ,
May 04, 2017 May 04, 2017
LATEST

This morning I remembered the "Rearrange" UI command, and was unsure if that was accessible through script. I guess it is!

This worked, thanks!

scott

Translate
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