That worked perfectly, thanks! I used it on Illustrator 2024 on Mac and no issues at all - of course the location of the script is in the contents of the illustrator app, but that is easy to navigate to in Finder
1. Copy one of the existing files from the Scripts-folder to Desktop 2. Open in TextEdit and replace all the text with the script in the description 3. Save and change the file name to area.jsx 4. Copy the file from desktop to the Scripts-folder 5. In Illustrator select object and go to File > Scripts > Other script and select area.jsx
Always astounded by the myriad things I don't know how to do that I can pass along to other people and have them think I'm somehow smarter than the average bear. This one is going top of list tho.
Below is a script that loops through all selected items in Adobe Illustrator, displays each item’s area and length in mm/inches, and then adds a total for all selected items at the end. /** * Show the area/length of each selected path item in a table-like format, * plus a total row at the bottom. */ if (app.activeDocument.selection.length === 0) { alert("No objects selected."); } else { var sel = app.activeDocument.selection; // For basic alignment in the ASCII table // (ExtendScript doesn't support String.padEnd() by default) function padRight(str, length) { while (str.length < length) { str += " "; } return str; } // Track the sum of area (in points^2) and length (in points) for all items var totalAreaPoints = 0; var totalLengthPoints = 0; // Header row var message = ""; message += "Item | Area (mm²) | Area (in²) | Length (mm) | Length (in) "; message += "----------------------------------------------------------------------------------------- "; // Process each selected item for (var i = 0; i < sel.length; i++) { var currentItem = sel[i]; // If area or length are undefined (e.g., if it's not a PathItem), skip if (typeof currentItem.area === "undefined" || typeof currentItem.length === "undefined") { continue; } // Use Math.abs for area to avoid negative values var areaPoints = Math.abs(currentItem.area); var lengthPoints = currentItem.length; // Convert to mm and inches var areaMM = (areaPoints / 8.03521617).toFixed(4); var areaIN = (areaPoints / 5184).toFixed(4); var lengthMM = (lengthPoints / 2.8346567).toFixed(4); var lengthIN = (lengthPoints / 72).toFixed(4); // Add to totals totalAreaPoints += areaPoints; totalLengthPoints += lengthPoints; // Build table row // Adjust widths to keep columns nicely aligned var row = ""; row += padRight(String(i + 1), 4) + " | "; row += padRight(areaMM, 22) + " | "; // " 12345.6789" row += padRight(areaIN, 19) + " | "; // " 12345.6789" row += padRight(lengthMM, 17) + " | "; // " 12345.6789" row += padRight(lengthIN, 13) + " "; // " 12345.6789" message += row; } // Totals var totalAreaMM = (totalAreaPoints / 8.03521617).toFixed(4); var totalAreaIN = (totalAreaPoints / 5184).toFixed(4); var totalLengthMM = (totalLengthPoints / 2.8346567).toFixed(4); var totalLengthIN = (totalLengthPoints / 72).toFixed(4); message += "----------------------------------------------------------------------------------------- "; message += "TOTAL | " + padRight(totalAreaMM, 22) + " | " + padRight(totalAreaIN, 19) + " | " + padRight(totalLengthMM, 17) + " | " + padRight(totalLengthIN, 13) + " "; alert(message); }
Alternative script works great for me. Thank you so much!
Thank you so much, this is extremely usefull and so easy to install. Thank you!
Perfect! Thanks
Thank you! It helped immensely!
This is absolutely helpful, thank you!!!!
That worked perfectly, thanks! I used it on Illustrator 2024 on Mac and no issues at all - of course the location of the script is in the contents of the illustrator app, but that is easy to navigate to in Finder
Amigo, no encuentro la opción en Mac, tú crees que me puedas ayudar compartiendo la ruta😢?.
This worked beautifully.. just 1 question.. does length here mean like the perimeter of the shape?
Simplemente Genial!!! mil gracias!!
Any tips to make this work on Mac IOS? Followed everything but im getting a syntax error
same
same!
same
1. Copy one of the existing files from the Scripts-folder to Desktop
2. Open in TextEdit and replace all the text with the script in the description
3. Save and change the file name to area.jsx
4. Copy the file from desktop to the Scripts-folder
5. In Illustrator select object and go to File > Scripts > Other script and select area.jsx
Nice presentation! Easy to follow. PS: there seem to be a square missing: Area is in mm^2, not mm.
Always astounded by the myriad things I don't know how to do that I can pass along to other people and have them think I'm somehow smarter than the average bear. This one is going top of list tho.
How can I get this script?
Thank you so much
how it's possible that the area is in mm and not in a square mesure
I need this script , how to download ??
My nerd ❤️❤️
same
@@rezaakbari6797 😳
Below is a script that loops through all selected items in Adobe Illustrator, displays each item’s area and length in mm/inches, and then adds a total for all selected items at the end.
/**
* Show the area/length of each selected path item in a table-like format,
* plus a total row at the bottom.
*/
if (app.activeDocument.selection.length === 0) {
alert("No objects selected.");
} else {
var sel = app.activeDocument.selection;
// For basic alignment in the ASCII table
// (ExtendScript doesn't support String.padEnd() by default)
function padRight(str, length) {
while (str.length < length) {
str += " ";
}
return str;
}
// Track the sum of area (in points^2) and length (in points) for all items
var totalAreaPoints = 0;
var totalLengthPoints = 0;
// Header row
var message = "";
message += "Item | Area (mm²) | Area (in²) | Length (mm) | Length (in)
";
message += "-----------------------------------------------------------------------------------------
";
// Process each selected item
for (var i = 0; i < sel.length; i++) {
var currentItem = sel[i];
// If area or length are undefined (e.g., if it's not a PathItem), skip
if (typeof currentItem.area === "undefined" || typeof currentItem.length === "undefined") {
continue;
}
// Use Math.abs for area to avoid negative values
var areaPoints = Math.abs(currentItem.area);
var lengthPoints = currentItem.length;
// Convert to mm and inches
var areaMM = (areaPoints / 8.03521617).toFixed(4);
var areaIN = (areaPoints / 5184).toFixed(4);
var lengthMM = (lengthPoints / 2.8346567).toFixed(4);
var lengthIN = (lengthPoints / 72).toFixed(4);
// Add to totals
totalAreaPoints += areaPoints;
totalLengthPoints += lengthPoints;
// Build table row
// Adjust widths to keep columns nicely aligned
var row = "";
row += padRight(String(i + 1), 4) + " | ";
row += padRight(areaMM, 22) + " | "; // " 12345.6789"
row += padRight(areaIN, 19) + " | "; // " 12345.6789"
row += padRight(lengthMM, 17) + " | "; // " 12345.6789"
row += padRight(lengthIN, 13) + "
"; // " 12345.6789"
message += row;
}
// Totals
var totalAreaMM = (totalAreaPoints / 8.03521617).toFixed(4);
var totalAreaIN = (totalAreaPoints / 5184).toFixed(4);
var totalLengthMM = (totalLengthPoints / 2.8346567).toFixed(4);
var totalLengthIN = (totalLengthPoints / 72).toFixed(4);
message += "-----------------------------------------------------------------------------------------
";
message += "TOTAL | "
+ padRight(totalAreaMM, 22) + " | "
+ padRight(totalAreaIN, 19) + " | "
+ padRight(totalLengthMM, 17) + " | "
+ padRight(totalLengthIN, 13) + "
";
alert(message);
}
Gracias
The units of area are length^2.