Quitter
  • Communauté internationale
    • Langue:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티

Action to Resize Art Board to custom size

Débutant dans la communauté ,
Jun 26, 2023 Jun 26, 2023

Hey Creatives!

Got a quick question, Im wondering if anyone can walk me through how id set up an action to select and artboard change the width to 82 and the height to 51. I would then futher need one for 98x51 but I bet once we figure out the first one the following should just be inputting different numbers in its place.

 

I work at a printing/packaging place & we are starting to dive into the world of VDPS. (This would help the process greatly)

SUJETS
Guide pratique , Scripting
2.8K
Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines

correct answers 3 bonnes réponses

Community Expert , Jun 26, 2023 Jun 26, 2023

How about a script - similar to the one for Illustrator | Java Script for resizing the canvas?

 

Traduire
Guide , Jun 26, 2023 Jun 26, 2023

You can save this script and run it from an action.  You have not specified the units; default units are points. 

var w = 82;
var h = 51;
var doc = app.activeDocument;
var i = doc.artboards.getActiveArtboardIndex();
var AB = doc.artboards[i];
var ABR = AB.artboardRect;
AB.artboardRect = [
    ABR[0] + ((ABR[2] - ABR[0]) / 2) - w / 2,
    ABR[1] + ((ABR[3] - ABR[1]) / 2) + h / 2,
    ABR[0] + ((ABR[2] - ABR[0]) / 2) - w / 2 + w,
    ABR[1] + ((ABR[3] - ABR[1]) / 2) + h / 2 - h
];

 

Traduire
Guide , Jun 28, 2023 Jun 28, 2023

The errors imply that the script is either not saved in the right format or not being run form the right place.

 

  1. The script should be saved in the Scripts folder. The Scripts folder should be somewhere like: Applications > Adobe Illustrator CC > Presets > en_GB > Scripts.
  2. The script should be saved with a .jsx (or .js) extension. Copy the above script to a plain text file and save with a .jsx extension. I have not used macs, but I understand that Apple's TextEdit, by default, will save as rich text; this is not what you want; you want plain text.
...
Traduire
Adobe
Community Expert ,
Jun 26, 2023 Jun 26, 2023

How about a script - similar to the one for Illustrator | Java Script for resizing the canvas?

 

Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines
Guide ,
Jun 26, 2023 Jun 26, 2023

You can save this script and run it from an action.  You have not specified the units; default units are points. 

var w = 82;
var h = 51;
var doc = app.activeDocument;
var i = doc.artboards.getActiveArtboardIndex();
var AB = doc.artboards[i];
var ABR = AB.artboardRect;
AB.artboardRect = [
    ABR[0] + ((ABR[2] - ABR[0]) / 2) - w / 2,
    ABR[1] + ((ABR[3] - ABR[1]) / 2) + h / 2,
    ABR[0] + ((ABR[2] - ABR[0]) / 2) - w / 2 + w,
    ABR[1] + ((ABR[3] - ABR[1]) / 2) + h / 2 - h
];

 

Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines
Débutant dans la communauté ,
Jun 28, 2023 Jun 28, 2023

Youre completely right! in this case it would be inches...

So would I simply add inches after the 82 & 51?

Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines
Community Expert ,
Jun 28, 2023 Jun 28, 2023

Multiply those by 72 to get the dimensions in points.

Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines
Débutant dans la communauté ,
Jun 28, 2023 Jun 28, 2023

var w = 5904;
var h = 3672;
var doc = app.activeDocument;
var i = doc.artboards.getActiveArtboardIndex();
var AB = doc.artboards[i];
var ABR = AB.artboardRect;
AB.artboardRect = [
ABR[0] + ((ABR[2] - ABR[0]) / 2) - w / 2,
ABR[1] + ((ABR[3] - ABR[1]) / 2) + h / 2,
ABR[0] + ((ABR[2] - ABR[0]) / 2) - w / 2 + w,
ABR[1] + ((ABR[3] - ABR[1]) / 2) + h / 2 - h
];

 

Converted inches to points and I went to add the script, but was stopped with an error. (Please see attached)

 

Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines
Guide ,
Jun 28, 2023 Jun 28, 2023

The errors imply that the script is either not saved in the right format or not being run form the right place.

 

  1. The script should be saved in the Scripts folder. The Scripts folder should be somewhere like: Applications > Adobe Illustrator CC > Presets > en_GB > Scripts.
  2. The script should be saved with a .jsx (or .js) extension. Copy the above script to a plain text file and save with a .jsx extension. I have not used macs, but I understand that Apple's TextEdit, by default, will save as rich text; this is not what you want; you want plain text...
  3. The script should be run from illustrator, by going through File > Scripts.

 

Once you have the script up and running, you can incorporate it into an action.  

Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines
Débutant dans la communauté ,
Jun 28, 2023 Jun 28, 2023

Thanks! After fighting with saving as .js we now have two working scripts which will help stream line a workflow!

Hope everyone has an amazing day.

Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines
Community Expert ,
Jun 28, 2023 Jun 28, 2023

A little tip:

Change the extension to jsx. This is the usual extension for javascripts in Adobe programmes.

Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines
Nouveau ici ,
Sep 04, 2024 Sep 04, 2024
LA PLUS RÉCENTE

It is very important to understand that Illustrator coordinate systems are not normal. You will get a 1346458189 PARM error if you have a set of bad coordinates, IE the one Illustrator wants to be negative or larger than the other is not. Please see this Stack Overflow answer for more details. https://stackoverflow.com/a/39417304

Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines