Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

Creating Multiple Artboards

$
0
0

I thought I'd ask this question here seeing as how everything I've learned about scripting has come from the knowledge everyone shares here (granted, I've only been at this a couple weeks now).

 

I've searched and searched and have been trying for three days to figure this out but can't.  I've studied the scripts at http://forums.adobe.com/message/5082308#5082308 and tried implementing them but to no avail.

 

Basically, I have a document with multiple layers, all containing only one item each.  Every placedItem is a tiff, all having the same dimensions.  There could be either 4 or 6 of them, no more, no less.  I'd like to split them up onto multiple artboards but whenever I try, I keep getting multiple boards put in the same location, e.g., stacked on top of one another.  I can't seem to figure out the gridByRow command.

 

So far, I'm using the following script (that I found here) to build the file, which I've altered to fit my needs.

 

 

function getFolder() {          return Folder.selectDialog('Please select the folder to be imported:', Folder('~'));
}


function importFolderAsLayers(selectedFolder) {
          // if a folder was selected continue with action, otherwise quit          var myDocument;          if (selectedFolder) {                    myDocument = app.documents.add();                    var firstImageLayer = true;                    var newLayer ;                    var thisPlacedItem;                    // create document list from files in selected folder                    var imageList = selectedFolder.getFiles();                    for (var i = 0; i < imageList.length; i++) {                              // open each document in file list                              if (imageList[i] instanceof File) {                                        // get the file name                                        var fName = imageList[i].name;                                        // check for supported file formats                                        //if( (fName.indexOf(".eps") == -1) ) {                                        if( (fName.indexOf("Base.tif") == -1) && (fName.indexOf("White.tif") == -1) && (fName.indexOf("Process%20Yellow.tif") == -1) && (fName.indexOf("Process%20Cyan.tif") == -1) && (fName.indexOf("Process%20Magenta.tif") == -1) && (fName.indexOf("Process%20Black.tif") == -1)) {                                                  // skip unsupported formats                                                  continue;                                        } else {                                                  if( firstImageLayer ) {                                                            newLayer = myDocument.layers[0];                                                            firstImageLayer = false;                                                  } else {                                                            newLayer = myDocument.layers.add();                                                  }                                           // Give the layer the name of the image file                                           newLayer.name = fName.substring(0, fName.indexOf(".") );                                           // Place the image on the artboard                                           thisPlacedItem = newLayer.placedItems.add()                                           thisPlacedItem.file = imageList[i];                                        }                              }                    }

 

What I'd like to do at this point is spread these layers out to multiple artboards, which have been made based on the number of layers in the file.

 

3 days!  I'm pulling my hair out.  Can someone help?  Using CS5.


Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>