Copy link to clipboard
Copied
Bonjours à vous mes amis graphiste et developpeurs, j'aurais besoin d'aide pour créer un Script dans Illustrator je m'explique :
J'ai 500 fichiers à ouvrir -> Modifier la taille du plans de travail -> Save Exit
J'ai cherché quelques scripts qui pourrait m'être utile afin d'automatisé tout ca, bémole je n'arrive pas à récupérer la taille de mon plan de travail avec la console JS :
var doc = app.activeDocument;
var artboard = doc.artboards[0];
artboard.artboardRect = [0, 0, 300, 200];
Hello, my friends in graphic design and development! I need help creating a script in Illustrator. Here's what I'm trying to achieve:
I have 500 files to open -> Modify the artboard size -> Save and close
I've searched for some scripts that could be useful to automate this, but I'm having trouble retrieving the artboard size with the JS console:
var doc = app.activeDocument;
var artboard = doc.artboards[0];
artboard.artboardRect = [0, 0, 300, 200];
I'm getting an error: "An Illustrator error occurred: 1346458189 ('PARM')".
Do you know a technique that would allow me to modify this "artboard"? Action scripts don't seem to recognize actions performed on artboards.
If anyone has an idea or a solution, I would greatly appreciate it! Have a great day!
change the last number to be negative. My brain isn't remembering the reasons why, and I dont want to give you wrong information, but if you change the 200 in your rectangle coordinates to be -200 it should work.
app.activeDocument.artboards[0].artboardRect = [0, 0, 300, -200];
Copy link to clipboard
Copied
change the last number to be negative. My brain isn't remembering the reasons why, and I dont want to give you wrong information, but if you change the 200 in your rectangle coordinates to be -200 it should work.
app.activeDocument.artboards[0].artboardRect = [0, 0, 300, -200];
Copy link to clipboard
Copied
That's it ! Thank u so much 🙂
Copy link to clipboard
Copied
try this
function modificarTamaño(ancho, alto) {
var mainArtb = app.activeDocument.artboards[0];
var rect = mainArtb.artboardRect;
var x = rect[0] + (rect[2] - rect[0]) / 2;
var y = rect[1] + (rect[3] - rect[1]) / 2;
mainArtb.artboardRect = [
x - ancho / 2,
y + alto / 2,
x + ancho / 2,
y - alto / 2,
];
}
modificarTamaño(300, 200);
Copy link to clipboard
Copied
U'r function works but, the first answers by RobOctopus was more easy ahah
Copy link to clipboard
Copied
Back in CS5, the origin was changed from the left bottom to the left top. So y values should be negative, as in the examples above.
Copy link to clipboard
Copied
Thank you guy for u'r answer !