Copy link to clipboard
Copied
Hi everyone !
This question may have already been answered, but I didn't find any.
Here is my issue : I'd like to selection a lot of different object (which are circles) and redimension each of them separately to 10px (they are at 13 px right now)
Someone told me I should use a script, but I don't know how, does anyone could help me with that ?
Thank you for your kindness
Hi,
Is "redimension" mean resizing?
It is easy to resize each object. But It is difficult for me to align pixel grid after resizing via script. If you create something like an icon for web, you may need it.
The following script resize each selected object (excluding stroke width).
If your work is like this, try:
...(function () {
if (app.documents.length === 0) {
return;
}
var doc = app.activeDocument,
sel = doc.selection,
size = new UnitValue(10, "px").as("pt"),
Copy link to clipboard
Copied
Hi,
Is "redimension" mean resizing?
It is easy to resize each object. But It is difficult for me to align pixel grid after resizing via script. If you create something like an icon for web, you may need it.
The following script resize each selected object (excluding stroke width).
If your work is like this, try:
(function () {
if (app.documents.length === 0) {
return;
}
var doc = app.activeDocument,
sel = doc.selection,
size = new UnitValue(10, "px").as("pt"),
i,
max;
for (i = 0, max = sel.length; i < max; i += 1) {
if (sel.hasOwnProperty("resize")) {
sel.resize(size / sel.width * 100, size / sel.height * 100);
}
}
}());
Copy link to clipboard
Copied
Thank you for your answer, I will try it as soon as I learn how to use scripts in Illustrator !
Copy link to clipboard
Copied
Hello!
Did you know how to use the script?
Copy and paste this code using a text editor and save it as a text file with the name of "favoriteName.jsx".
Launch Illustrator and navigate File > Scripts > Other Script and choose the file "favoriteName.jsx".
Then the script is executed.