• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
3

Scripts / JavaScript

Community Beginner ,
Jan 29, 2024 Jan 29, 2024

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];

 

> var doc = app.activeDocument;
var artboard = doc.artboards[0];
artboard.artboardRect = [0, 0, 300, 200];
Erreur: an Illustrator error occurred: 1346458189 ('PARM')
 
Connaissez vous une technique qui me permettrai de modifié ce "artboard" ? 
Les scripts d'actions ne reconnais pas les actions éffectué sur les plans de travails. 
Si quelqu'un à une idée ou la solution je suis preneur ! 
Bonne fin de journée à vous ! 
 
 

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];

 

> var doc = app.activeDocument;
var artboard = doc.artboards[0];
artboard.artboardRect = [0, 0, 300, 200];
Erreur: an Illustrator error occurred: 1346458189 ('PARM')
 

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!

 

 

 

TOPICS
Bug , Experiment , Feature request , How-to , Scripting , Tools

Views

219

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Jan 29, 2024 Jan 29, 2024

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];

Votes

Translate

Translate
Adobe
Participant ,
Jan 29, 2024 Jan 29, 2024

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];

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 29, 2024 Jan 29, 2024

Copy link to clipboard

Copied

That's it ! Thank u so much 🙂 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 29, 2024 Jan 29, 2024

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);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 29, 2024 Jan 29, 2024

Copy link to clipboard

Copied

LATEST

U'r function works but, the first answers by RobOctopus was more easy ahah 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jan 29, 2024 Jan 29, 2024

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. 

femkeblanco_0-1706569565232.png

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 29, 2024 Jan 29, 2024

Copy link to clipboard

Copied

Thank you guy for u'r answer ! 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines