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

Java script for finding active artboard dimensions for illustration batch files

Community Beginner ,
Nov 24, 2023 Nov 24, 2023

Hello folks,

I am new to this forum, currently working on a project where i recieved a bunch of illustration batch files (1000 plus files in eps format) , with no coding knowledge

 

Requirement: i need a script or code that run through this bunch of illustrator batch files (eps files) at a time and fetches the active artboard width and height dimensions for all batch files and print this data in an excel.

can any one guide me on this,

Thanks in advance,

TOPICS
Draw and design , Experiment , Feature request , How-to , Import and export , Performance , Print and publish , Scripting , SDK , Sync and storage , Tools , Type
285
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
Adobe
Community Expert ,
Nov 24, 2023 Nov 24, 2023

There are already a couple of scripts for Adobe Bridge which can do it hand over fist.

 

You may do a search for "extract metadata script adobe bridge" or something similar.

 

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
Explorer ,
Nov 26, 2023 Nov 26, 2023
LATEST
Select the folder containing the eps
Create a csv on the same level
 
↓script
-----
 
//Header
sNo = "S.No"
sName = "Name"
sWpt = "Active artboard width in points"
sHpt = "Active artboard height in points"
//
sFileType = "eps"
 
main();
 
function main(){
folderRef = Folder.selectDialog("Select Folder");
if( folderRef != false){
fileList = folderRef.getFiles("*." + sFileType)
if( fileList != false){
fileList.sort(compare)
sText = sNo + "," + sName + "," + sWpt + "," + sHpt
ifl = fileList.length
for (var i=0;i<ifl;i++){
sText += "\r" 
fileObj = new File(fileList[i].fsName);
app.userInteractionLevel=UserInteractionLevel.DONTDISPLAYALERTS;
open(fileObj);
app.userInteractionLevel=UserInteractionLevel.DISPLAYALERTS;
oDoc = app.activeDocument;
sText += i+1
sText += "," + decodeURI(oDoc.name.replace(("." + sFileType),""))
sText += "," + (oDoc.artboards[0].artboardRect[2]-oDoc.artboards[0].artboardRect[0]) + " pt"
sText += "," + -(oDoc.artboards[0].artboardRect[3]-oDoc.artboards[0].artboardRect[1]) + " pt"
oDoc.close(SaveOptions.DONOTSAVECHANGES);
oDoc = null
};
var oFile = new File(folderRef.path + "/" + "Output.csv") ;
oFile.open ("w","","");
oFile.encoding = "UTF-8"
oFile.writeln(sText);
};
};
}
function compare(a,b){
regex = new RegExp(/[0-9]+/);
    index = 0
    a_num = parseInt(a.name.match(regex))
    b_num = parseInt(b.name.match(regex))
 
 
    if (a_num > b_num) {
        index = 1
    }else if (a_num < b_num) {
        index = -1
    }
    return index
}
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