5
Java script for finding active artboard dimensions for illustration batch files
Community Beginner
,
/t5/illustrator-discussions/java-script-for-finding-active-artboard-dimensions-for-illustration-batch-files/td-p/14255938
Nov 24, 2023
Nov 24, 2023
Copy link to clipboard
Copied
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explore related tutorials & articles
Community Expert
,
/t5/illustrator-discussions/java-script-for-finding-active-artboard-dimensions-for-illustration-batch-files/m-p/14256069#M388773
Nov 24, 2023
Nov 24, 2023
Copy link to clipboard
Copied
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.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explorer
,
LATEST
/t5/illustrator-discussions/java-script-for-finding-active-artboard-dimensions-for-illustration-batch-files/m-p/14259658#M388973
Nov 26, 2023
Nov 26, 2023
Copy link to clipboard
Copied
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
}
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

