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

Script création de plans de travail

New Here ,
Oct 25, 2022 Oct 25, 2022

Copy link to clipboard

Copied

Bonjour, j'ai réussi grâce à la commande "Ajuster à l'illustration sélectionnée" à créer un script qui adapte le plan de travail par défaut à la sélection en cours.

Je souhaite maintenant créer un script pour ajouter un deuxième, puis un troisième… plan de travail mais n'y arrive pas car le petit carré contenant un + qu'il faut cliquer pour cela dans la barre d'outils ne s'enregistre pas dans le script.

Quelqu'un a-t-il une solution, s'il vous plaît ?

 

 

TOPICS
Feature request , Scripting

Views

223

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
Adobe
People's Champ ,
Nov 01, 2022 Nov 01, 2022

Copy link to clipboard

Copied

Bonjour,

Il vous faut regarder la méthode suivante: artboards.add();

https://ai-scripting.docsforadobe.dev/jsobjref/Artboards.html

Bien à vous,

Loic

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
New Here ,
Nov 02, 2022 Nov 02, 2022

Copy link to clipboard

Copied

Bonjour Loic

Merci pour votre réponse, rapide de surcroît !

Malheureusement, une fois que j'ai cliqué sur le lien que vous donnez et répéré "Artboards.add()", je ne sais pas me servir de cette info. Rien n'est cliquable à ce niveau qui me mènerait vers un tuto ou une procédure.

Pourriez-vous, aussi, m'indiquer la marche à suivre à partir de là, s'il vous plaît ?

Cordialement

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 Expert ,
Nov 02, 2022 Nov 02, 2022

Copy link to clipboard

Copied

the method artboards.add() requires a paramether

artboards.add(artboardRect)

 

artboardRect, the documentation in the link tells your it refers to the artboard dimensions, but it does not give you an example. It expects an array of values [left, top, right, bottom]

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 Expert ,
Nov 02, 2022 Nov 02, 2022

Copy link to clipboard

Copied

try downloading the Scripting Reference from here, log in with your adobe id

https://developer.adobe.com/console/home

 

it has examples in it

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
People's Champ ,
Nov 02, 2022 Nov 02, 2022

Copy link to clipboard

Copied

Hello, 

Il vous faut appeler la méthode add depuis l'objet artboards, lui même rattaché à un objet de type document, lui même enfin rattaché à l'objet app.

En d'autres termes:

var doc = app.documents.add();
var abs = doc.artboards;
var nthArtboard = doc.artboards[abs.length-1];
var nthRect = nthArtboard.artboardRect;
var x1 = nthRect[2]+10;
var y1 = nthRect[1];
var x2 = x1 + nthRect[2];
var y2 = nthRect[3];
var myNewArtboard = doc.artboards.add([x1,y1,x2,y2]);

Note that I laid on this post for reference :https://stackoverflow.com/questions/43540803/how-to-add-an-artboard-to-a-document-in-adobe-illustrat...

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 ,
Nov 02, 2022 Nov 02, 2022

Copy link to clipboard

Copied

LATEST

This will add you n artboards to the right.

var n = 3, gap = 10;
var ABs = app.activeDocument.artboards;
for (var i = 0; i < n; i++) {
    var ABR = ABs[i].artboardRect;
    var addedAB = ABs.add([
        ABR[2] + gap, ABR[1], 
        ABR[2] + (ABR[2]-ABR[0]) + gap, ABR[3]]);
}

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