renél80416020
Advocate
renél80416020
Advocate
Activity
Feb 22, 2024
12:39 AM
Bonjour Rob, Il faut copier le texte dans un éditeur de texte et l'enregistrer avec l'extension .js ou .jsx Ce doit être du texte pure qui sera interprété par Illustrator au lancement du script. Vous pouvez utiliser ExtendScript Toolkit.exe si ce programme est installé sur votre système.
... View more
Feb 21, 2024
03:10 PM
Thanks for the update @MidoSemsem!.
... View more
Feb 14, 2024
03:43 PM
1 Upvote
Why would you expect anyone to help you if you're rude to the first person who tries?
... View more
Feb 08, 2024
02:55 AM
1 Upvote
Bonjour, J'ai essayé d'imaginer un scénario simple pour "enregistrer un symbole qui passe automatiquement à la valeur numérique suivante". Le principe repose sur une sélection dont l'ordre déterminera la numérotation. La numérotation démarre à l'opposé objet situé en arrière plan (index de départ variable "deb" zone INIT du script). Pour le test, il existe deux modes de sélection a et B. Les objets sélectionnés seront remplacés chacun par une instance d'un nouveau symbole indexé, si le premier objet de la sélection est une instance de symbole (mode A), ce symbole devient l'élément de référence, peu importe son nom si non l'élément de référence sera un symbole existant de nom "test" (mode B) valeur par défaut (variable symbolRefName) Un nouveau symbole indexé est créé seulement si celui ci n’existe pas. Remarque: Les instances du symboles indexés adoptent la position de l'objet sélectionné [left,top], elle ne sont pas redimensionnées. Leur nom correspond au nom de l'élément de référence plus un espace suivi de l'index (test 1, test 2...) Avant de lancer le test, vous devrez créer un symbole sensiblement identique à "test", et en créer un autre par exemple en remplaçant le cercle par un carré (deux tracés: un trait fléché et un cercle au premier plan, puis grouper l'ensemble ou non). Attention! Il faut impérativement nommer le container (l'élément qui reçoit l'index) par défaut "c" (variable contName). Il est bien sur possible d'aller plus loin ou d'envisager d'autres approches... René // INIT --------------------
var symbolRefName = "test"; // Name of the reference symbol
var deb = 1; // Starting index of the number to be placed in the symbols
var contName = "c"; // Container Name
//-------------------------- Un autre exemple pour s'amuser un peu... Je veux placer des pions numérotés sur un damier. Outil Grille (6x6) PathFinder > Division Objet >dissocier Symbole nommé "test" un seul tracé cercle nommé "c" Zut c'est le désordre! c'est vraiment pas ce que je voulais. (Grille par colonne) Trouvez la solution... // JavaScript Document for Illustrator
// symbol auto num 011.js
// Author Landry René
// 31/01/2024 18:29:30
// INIT --------------------
var symbolRefName = "test"; // Name of the reference symbol
var deb = 1; // Starting index of the number to be placed in the symbols
var contName = "c"; // Container Name
//--------------------------
if (app.documents.length) main();
function main() {
if (selection.length == 0) return;
var docRef = app.activeDocument;
var sel = [], activeLayer, sym, symItem, s, c;
for (var j = 0; j < selection.length; j++) {
sel.push(selection[j]);
}
selection = null;
activeLayer = sel[0].layer;
if (sel[0].typename == "SymbolItem") {
symItem = sel[0];
symbolRefName = symItem.symbol.name;
}
else {
sym = getSymbl(activeDocument,symbolRefName,true)
if (sym == undefined) {return;}
symItem = activeLayer.symbolItems.add(sym);
}
symItem.selected = true;
// expand symbol item.
app.executeMenuCommand('Expand3');
redraw();
var layer, s, c, d;
layer = activeLayer.layers[0];
if (layer.layers.length > 0) {
alert("Does the reference symbol contain an extra layer?");
return;
}
nb = layer.pageItems.length;
if (nb == 0) { undo(); return;}
if (nb == 1 && layer.pageItems[0].typename == "GroupItem") {
s = layer.pageItems[0];
c = getPageItems(s,contName,true);
if (c == undefined) {undo(); return;}
c.zOrder(ZOrderMethod.BRINGTOFRONT);
}
else {
s = layer.groupItems.add();
nb = layer.pageItems.length;
for (var cd = nb-1; cd >= 1 ; cd--) {
layer.pageItems[cd].move(s, ElementPlacement.PLACEATEND);
}
c = getPageItems(s,contName,true);
if (c == undefined) {undo(); return;}
c.zOrder(ZOrderMethod.BRINGTOFRONT);
}
var dup, sname, pos, left, top, t;
for (var j = sel.length-1, k = deb; j >= 0; j--) {
sname = symbolRefName+" "+k;
dup = s.duplicate();
dup.name = sname;
pos = sel[j].position;
dup.position = pos;
if (getSymbl(activeDocument,sname,false) == undefined) {
c = dup.pathItems[contName];
posc = c.position;
left = posc[0]+c.width/2;
top = posc[1]-c.height/2-6;
t = dup.textFrames.pointText([left,top]);
t.contents = k;
t.textRange.size = 18;
t.paragraphs[i].justification = Justification.CENTER;
nouvSymbol(activeLayer,dup);
}
else {
dup.remove();
sym = getSymbl(docRef,sname,false);
dup = activeLayer.symbolItems.add(sym);
dup.position = pos;
}
k++;
if (sel[j].typename != "SymbolItem") sel[j].remove();
else if (j > 0) sel[j].remove();
} // end for j
layer.remove();
}
// -------
function nouvSymbol(placeDoc,atObjet)
{ // creates a new symbol, and replaces the original with that symbol
if (getSymbl(activeDocument,atObjet.name,false) == undefined) {
var nSymbol = activeDocument.symbols.add(atObjet);
nSymbol.name = atObjet.name;
var objetRef = placeDoc.symbolItems.add(nSymbol);
objetRef.position = atObjet.position;
atObjet.remove();
}
}
//--------
function getSymbl(relativObjet,name,info) {
try {
var symb = relativObjet.symbols.getByName(name);
} catch (e) {
if (info) alert( "The name "+name+" of the symbol does not exist" );
return undefined;
}
return symb;
}
//--------
function getPageItems(relativObjet,name,info) {
try {
var symb = relativObjet.pageItems.getByName(name);
} catch (e) {
if (info) alert( "The name "+name+" of the objet does not exist" );
return undefined;
}
return symb;
}
//--------
... View more
Feb 07, 2024
01:25 PM
Hi @TestriteVisual, yes you need all the functions to make this work. Also see updated script where I fixed a bug that René noticed.
But, like @renél80416020, I'm confused about what you are actually doing. If you want to go deeper here, please explain in detail your starting conditions and what you are trying to do. Why do you talk about path finder? Why not just draw the path(s) you want? And what does SVG have to do with it? Why not draw paths normally using pathItems.add and pathPoints.add? It is hard to give sensible answers when we have no idea of what you are doing and why you choose a difficult way.
- Mark
... View more
Feb 07, 2024
10:31 AM
Yes, that may happen with the action.
You may try the graphic style as per my other sample file above. It won't merge (after expanding appearance).
... View more
Nov 28, 2023
02:54 AM
Hi Can someone post a step-by-step guide on how to action the script on Macosx please? I am completely lost!
... View more
Nov 25, 2023
01:53 PM
Wonderful script, @renél80416020! Thanks for sharing.
- Mark
... View more
Nov 21, 2023
02:29 AM
Yes I suspect you are right, Jacob. Truly the project has now lost much of its appeal. Haha.
... View more
Oct 09, 2023
04:45 PM
function getArtboardIndexOf(item) {
for (var i = 0; i < doc.artboards.length; i++) {
var abBounds = doc.artboards[i].artboardRect;
var itemBounds = item.visibleBounds;
if (itemBounds[0] >= abBounds[0] &&
itemBounds[1] <= abBounds[1] &&
itemBounds[2] <= abBounds[2] &&
itemBounds[3] >= abBounds[3]) {
return i;
}
}
}
... View more
Sep 07, 2023
12:06 AM
yes, I'm working on a large canvas, thanks
... View more
Aug 23, 2023
12:47 PM
Merci pour la réponse timide mais positive... René
... View more
Aug 04, 2023
05:25 AM
1 Upvote
In a "dialog" type window and redraw() the width changes are instantaneous, that's what I wanted. In a "palette" window, you probably have to send the code over bridgeTalk, and that slows things down. var dep = 100;
var mm = new UnitValue(1 + " " + "mm").as('pt');
var doc = app.activeDocument;
var rec = doc.pathItems.rectangle(0,0,dep*mm,dep*mm);
app.redraw();
var p = new Window("dialog");
p.text = "rectangle";
p.alignChildren = ["center","top"];
p.spacing = 10;
p.margins = 16;
var g1 = p.add("group", undefined, {name: "g1"});
g1.orientation = "row";
g1.alignChildren = ["left","center"];
g1.spacing = 10;
g1.margins = 0;
var st1 = g1.add("statictext", undefined, undefined, {name: "st1"});
st1.text = "W:";
var st2 = g1.add("statictext", undefined, undefined, {name: "st2"});
st2.text = dep;
var b1 = g1.add("button", undefined, undefined, {name: "b1"});
b1.text = "-";
b1.preferredSize.width = 50;
var b2 = g1.add("button", undefined, undefined, {name: "b2"});
b2.text = "+";
b2.preferredSize.width = 50;
b1.onClick = function() {
dep--;
st2.text = dep;
rec.width = dep*mm;
redraw();
};
b2.onClick = function() {
dep++;
st2.text = dep;
rec.width = dep*mm;
redraw();
};
p.show();
... View more
Jul 09, 2023
09:27 AM
If those layers are missing, wouldn't you just want to exit the larger script so it can be fixed, then execute the script again? Could you integrate what you have at the beginning of the script to exit out?
Edit: For some reason, replies hadn't shown up when I replied to this.
... View more
Jul 07, 2023
02:23 AM
1 Upvote
@Astronomie-Québec schrieb:
More than three years later, this issue has still not been fixed. Adobe, what are you waiting for? 😞
If you want to reach out to the developers, you might want to use the platform that they use.
https://illustrator.uservoice.com
... View more
Jul 05, 2023
01:33 AM
Thank you all for your help. I tried something different to achieve the result I want by inserting a special and unique character between my 2 sentences and use a script to create the line break. Someone on another topic has created a small script to do that: https://community.adobe.com/t5/illustrator-discussions/select-all-text-layers-with-the-same-name/m-p/13898654#M371677
... View more
May 19, 2023
12:39 AM
Can this be applied to an automated action to apply to all the text boxes set on variables? If yes, could you explain to me how?
... View more
May 17, 2023
01:10 AM
Essayez cela... // JavaScript Document for Illustrator
var docRef = app.activeDocument,
objetSelect = selection[0],
rects = objetSelect.geometricBounds,
propRects = prop(rects),
larg = propRects[0],
haut = propRects[1],
objetRect = docRef.pathItems.rectangle(rects[1],rects[0],larg,haut);
objetSelect.remove();
// -------
function prop(Bounds) {return [Bounds[2]-Bounds[0],Bounds[1]-Bounds[3]];}
// -------
... View more
May 07, 2023
10:39 AM
you can record your own Action to try first script, or use the second script Charu posted, that one does not require the action to be present.
... View more
Apr 23, 2023
06:26 AM
Bonjour à tous! J'ai réalisé un script qui répond aux trois scénarios cités plus haut. Si intéressé, me contacter par mail... René PS Possibilité d'adapter ce script à votre convenance. exemples scénario 2
... View more
Apr 01, 2023
12:27 AM
Thank you for your help The script works perfectly! I wish you a happy life
... View more
Mar 15, 2023
06:39 AM
I was running into this same problem. Hitting Tab first to hide the panels worked a little better, but what seems to work all the time is if I already have a document open when I run my script. Then it won't error. If I run my script when there are no documents open (my script adds a new document), it will almost always fail.
... View more
Feb 15, 2023
08:49 PM
2 Upvotes
Thanks so much for this! I've been using illustrator for a bit of CNC vector work and some of the linework I've been generating has been totally random. This can add a ton of time to the CNC operations as the tool head is sent to polar opposite ends of the material between cuts. This script allows my CAM software to order the operations based on layers. Its saving me a ton of time.
... View more
Feb 13, 2023
10:03 AM
Bonjour Beff, Comme le précise M1b, la position du texte par rapport au tracé n'est pas toujours facile à prévoir. Ce qu'il faut savoir: Par défaut, le point de départ du texte est situé sur le point p0 (début du tracé) et aligné à gauche. Le texte est situé au dessus du tracé si le sens est positif (polarité), tu peux facilement inverser le sens du tracé en pointant l’outil plume sur le point p0 avant l’exécution du script. Ou après en faisant basculer le crochet central de l’autre coté du tracé, le sens du tracé se trouve ainsi inversé (basculement symétrique). René
... View more
Feb 11, 2023
10:15 PM
Hello @CarlosCanto could you help me clarify here ? "the scripts run automatically when you launch Illustrator and each time you run a script." so yes of course the startup script will pop up when I run another script Can we prevent this from happening? Or in other words, is it possible to have a scrip run run ONLY on startup ? If I take this script for example //Welcome script
var w = new Window ("dialog", "", undefined, {closeButton: true});
w.alignChildren = "right";
var texto= w.add("statictext", undefined, "BIENVENIDO GERSSON");
w.show (); do I need to specify or target something more in the script itself to make it run only when launching the app ? Thanks for your wisdom!
... View more
Feb 08, 2023
03:23 AM
1 Upvote
@renél80416020 @Met1 @femkeblanco O.k. the script is running well. I thought the script was about to devide words but it was to devide lines... Just did not remeber it and mixed it up. Thanxs for your answers.
... View more
Feb 07, 2023
09:56 AM
1 Upvote
Pour le sript: Limites Ne conviendrait pas pour les tracés transparents. Uniquement pour des tracés sans croisement et avec la reccherche de la largeur possible. Mode opératoire pour chaque tracé sélectionné 1 Mesurer la largeur du profil. 2 Dupliquer le tracé, couper ce nouveau tracé et conserver une seule bordure. 3 Créer un nouveau tracé ouvert décalé d’une demie largeur du bon coté. 4 Supprimer la bordure conservée en 3. 5 Suivant une option à définir, supprimer le tracé initial ou non (non représenté). René
... View more
Jan 29, 2023
09:48 PM
1 Upvote
Great answer Monika, i've just logged in especially to say thanks
... View more
Jan 28, 2023
08:21 AM
CORRECTION- I only have the option to export dwg, dxf when I tried a small object. When I try to export the file I need to export the options are gone again, Is there an export size limit to DWG ? My artboart size is 240 inches by 96 inches. There must be , because when I copy and paste aportion of my artboard into a new document this one 61"x 96: it now has the options again to export dwg. DEVELOPERS - Please enlarge the area we can work in and export to dwg from.
... View more