ObjectArea Script
This Adobe Illustrator script calculates and displays the area size of a selected object (path). It is designed for Adobe Illustrator CSx (tested on CS6 on Windows 64-bit) and requires exactly one selected object to run.

Description
- Purpose:
This script is used to calculate the area of a single selected path in an Illustrator document and display the result in a dialog window. - Functionality:
- Checks if a document is open and if exactly one object is selected.
- If no object is selected or if more than one object is selected, it alerts the user with an appropriate message.
- Displays a dialog window with radio buttons for selecting the unit of measurement:
- cm² (default),
- mm², and
- inches².
- Calculates the area based on the selected unit by applying a conversion multiplier.
- The computed area is shown in a text box that updates when a different measurement unit is selected.
- Technical Details:
- The script calculates the area in “pixels” first (using an internal conversion factor) and then applies a multiplier to convert this to the chosen unit.
- The conversion multipliers are:
- For cm²: 0.01,
- For mm²: 1 (i.e., direct output),
- For inches²: 0.00155.
- Conversion factor
8.03521617
is used to convert the object’s area from Illustrator’s internal unit to pixels.
Usage Instructions
- Open Document:
Open an Adobe Illustrator document that contains at least one path. - Select an Object:
Select exactly one path object in the document. - Run the Script:
Execute the script (object area calculation). - Dialog Interaction:
A dialog window titled “Object Area” will appear:
- The top panel displays the calculated area.
- The radio buttons allow you to switch between cm², mm², and inches² units.
- The area value in the text box updates immediately based on the selected unit.
- Close the Dialog:
Once you have reviewed the area measurement, close the dialog to end the script run.
This script is distributed under the MIT License and was originally created by Lucas Becker (https://github.com/runxel).
JavaScript
Area Size – Illustrator Script (0 downloads )
// ObjectArea.jsx
// Adobe Illustrator CSx script
// gives you the area size of an object
// test env: Adobe Illustrator CS6 oon Win x64
// 2016-02-03
// Lucas Becker
// https://github.com/runxel
// This script is distributed under the MIT License.
// -------------------------------------------------
main();
function main(){
if (documents.length < 1) return;
var selObjects = app.activeDocument.selection;
var selObjectsNum = selObjects.length;
if(selObjectsNum < 1){
alert("You must select one path before launching this script.")
return;
}
if(selObjectsNum > 1){
alert("Please select only one path at a time.")
return;
}
// show a dialog
var win = new Window("dialog", "Object Area");
win.orientation = "column";
win.alignChildren = "fill";
win.radioPanel = win.add("panel", [15, 76, 215, 122], "unit");
win.radioPanel.orientation = "row";
win.radioPanel.cm = win.radioPanel.add("radiobutton", undefined, "cm²");
win.radioPanel.mm = win.radioPanel.add("radiobutton", undefined, "mm²");
win.radioPanel.inch = win.radioPanel.add("radiobutton", undefined, "inches²");
win.radioPanel.cm.value = true;
win.output = win.add("panel", [15, 15, 240, 61], "area size");
win.output.orientation = "row";
win.output.txtBox = win.output.add("edittext", [175, 14, 370, 34], areaSize(0.01));
win.radioPanel.cm.onClick = function() {
win.output.txtBox.text = areaSize(0.01);
}
win.radioPanel.mm.onClick = function() {
win.output.txtBox.text = areaSize(1);
}
win.radioPanel.inch.onClick = function() {
win.output.txtBox.text = areaSize(0.00155);
}
win.show();
}
function areaSize(mult) {
var size = 0;
// standard value is in pixels
size = parseFloat(Math.abs(app.activeDocument.selection[0].area/8.03521617));
size = Math.abs(size * mult).toFixed(3)
return size;
}