femkeblanco
Guide
femkeblanco
Guide
Activity
Jan 29, 2021
04:51 AM
1 Upvote
Would you not just add a click listener to the OK button? As well as making your script more readable, if they close the script or exit the window nothing happens. For example... var button = parent.add("button", undefined, 'Ok');
button.onClick = function() {
//Do something when the ok button is pressed
};
... View more
Dec 06, 2022
05:56 PM
Just upgraded my system and this problem just started happening. My old computer specs are terrible compared to my upgrade. I did a screen share with an adobe customer service rep, but he couldn't seem to comprehend the difference of GPU and CPU preview. Hopefully this is fixed soon. Old PC: i5-8600k Asus or MSI Radeon RX580 8GB DDR4 Ram New PC: i7-12600KF Gigabyte RTX 3070 Ti 32GB DDR5 Ram
... View more
Jan 28, 2021
12:12 AM
1 Upvote
In the cold light of day, the arrow keys not working isn't that big of a deal to me. However, your solution is ingenious. Thank you.
... View more
Jan 27, 2021
02:05 AM
1 Upvote
I have found the error... First of all, the filepath was wrong. I found this while exporting as png with a script. It created a png with Filename+undifined.png on top level in the folderstructure. With fixing this and calling the function, it works just fine. // Exports current document to dest as a JPEG file with specified options,
// dest contains the full path including the file name
var jpg_dest = "C:/Users/fvo/Desktop/AR-Nummern Ablage/" + Artikelnummer.text + "/" +Artikelnummer.text + '.jpg';
function exportFileToJPEG(jpg_dest) {
if (app.documents.length > 0) {
var jpgexportOptions = new ExportOptionsJPEG();
jpgexportOptions.antiAliasing = false;
jpgexportOptions.qualitySetting = 70;
jpgexportOptions.artBoardClipping = true;
jpgexportOptions.optimization = true;
jpgexportOptions.ver
var jpgtype = ExportType.JPEG;
var fileSpec = new File(jpg_dest);
app.activeDocument.exportFile(fileSpec, jpgtype, jpgexportOptions);
}
}
exportFileToJPEG(jpg_dest);
... View more
Jan 26, 2021
02:37 PM
1 Upvote
@femkeblanco
I am glad that you have not forgotten the knowledge you were shown and that you are passing it on.
In this case, the script snippet was more of a mini tutorial (similar to a GIF file) to show each step and its implications.
I usually try to avoid "redraw ()" as much as possible.
... View more
Jan 24, 2021
08:14 PM
1 Upvote
Hi @Silly-V, that's an interesting problem. I don't think it has a general answer though. I think there will be spot color combos that can never be good, but I might be wrong. Anyway, it was fun to play with and useful for my learning. 🙂 - Mark
... View more
Jan 20, 2021
05:01 AM
Thanks so much, @femkeblanco !
... View more
Jan 19, 2021
01:06 PM
Oh! I see you are happy with the document.rasterize() method. I was on the wrong track because I read "the effect rasterize" in your question and assumed you needed a live effect version. Oops. Glad you sorted it out. 🙂
... View more
Jan 18, 2021
03:06 PM
The above script was unnecessarily bloated and lengthy. Here's a concise one, instead. var degree1 = prompt("", 0, "Angle (degrees)"), side = 200;
var AR = app.activeDocument.artboards[0].artboardRect;
var d1 = 2*side*Math.cos((degree1/2)*(Math.PI/180)); // diagonal 1
var d2 = 2*side*Math.sin((degree1/2)*(Math.PI/180)); // diagonal 2
var rhombus = activeDocument.pathItems.add();
rhombus.setEntirePath( [ [ AR[2]/2, AR[3]/2+d1/2 ], [ AR[2]/2-d2/2, AR[3]/2 ], [ AR[2]/2, AR[3]/2-d1/2 ], [ AR[2]/2+d2/2, AR[3]/2 ], [ AR[2]/2, AR[3]/2+d1/2 ] ] );
... View more
Jan 18, 2021
04:31 AM
2 Upvotes
Sorry for spamming this thread but I believe that I finally found a solution to my issue. I wanted to share it in case someone else has a similar problem. I began tinking about the process when you're not scripting. You always select the items you want to apply an effect to. I therefore used the loop from before to make three selections, I then group the selections one by one and ultimately I apply the warp effect to these groupItem objects. Here is the code: // Open a file using these preferences
var fileRef = new File(myPath + "mug_canvas_3.pdf");
if (fileRef != null) {
var docRef = open(fileRef, DocumentColorSpace.RGB, );
}
var docH = docRef.height;
var docW = docRef.width;
var ref1 = docH/3, ref2 = 2*docH/3;
var numGroupItems = docRef.groupItems.length;
//Print some relevant information about the document
$.writeln('docH: ' + docH + " docW: " + docW
+ " ref1: " + ref1 + " ref2: " + ref2
+ " num group items: " + numGroupItems);
var i, j, docGI = docRef.groupItems;
//Document is divided into three equally large areas which contain designs
//there might not be a design there, so this variable checks if there is
var designCheck = [];
//Loop three times for the three areas
for(j = 0; j < 3; j++) {
designCheck[j] = false;
docRef.selection = null;
//Loop through all groupItem elements in the document
for(i = 0; i < numGroupItems; i++) {
var gi = docGI[i];
//For the first area, check if groupItem contained within first third
if(gi.controlBounds[3] < (ref1 - 10) && j == 0) {
gi.selected = true;
designCheck[0] = true;
//For the second area, check if groupItem contained within second third
} else if(gi.controlBounds[3] < (ref2 - 10) && gi.controlBounds[3] > (ref1 + 10) && j == 1) {
gi.selected = true;
designCheck[1] = true;
//For the last area, check if groupItem contained within third third
} else if(j == 2 && gi.controlBounds[3] > (ref2 + 10)) {
gi.selected = true;
designCheck[2] = true;
}
}
//Group all the items selected to create one groupItem
app.executeMenuCommand("group");
}
app.redraw();
$.writeln('Num layers: ' + docRef.layers.length);
$.writeln('groups in layer: ' + docRef.layers[0].groupItems.length);
//Apply warp effect to all the groupItem elements in the layer
for(j = 0; j < docRef.layers[0].groupItems.length; j++) {
if(designCheck[j] === true) {
var placed = docRef.layers[0].groupItems[j];
var effectStr = '<LiveEffect name="Adobe Deform"><Dict data="R DeformValue -0.115 R DeformVert 0 B Rotate 0 I DeformStyle 1 R DeformHoriz 0 "/></LiveEffect>';
placed.applyEffect(effectStr);
//This applies an envelope effect to the warped object
//Useful if you want specific dimensions
app.redraw();
app.executeMenuCommand('expandStyle');
}
} Thank you again @Silly-V and @femkeblanco for the help. If you have any insights or comments on the solution please let me know 🙂
... View more
Jan 17, 2021
05:33 AM
4 Upvotes
You can use the hasSelectedArtwork property of a layer. var list = "";
for (var i = 0; i < app.activeDocument.layers.length; i++) {
if (app.activeDocument.layers[i].hasSelectedArtwork) {
list = list + app.activeDocument.layers[i].name + "\r";
}
}
alert( list ); Or the layer property of a pathItem. var list = "";
for (var i = 0; i < app.selection.length; i++) {
list = list + app.selection[i].name + " - " + app.selection[i].layer.name + "\r";
}
alert( list );
... View more
Jan 16, 2021
05:22 AM
var n = prompt("Enter even number ≥ 4", 4, "Number of circular sectors");
var d = app.activeDocument.artboards[0].artboardRect;
var paths = app.activeDocument.pathItems;
var circle1 = paths.ellipse(d[3]/2+250, d[2]/2-250, 500, 500);
var polygon1 = paths.polygon(d[2]/2, d[3]/2, 250, n);
var points1 = polygon1.pathPoints;
for (var i = 0; i < points1.length/2; i++) {
var line1 = paths.add();
var points2 = [points1[i].anchor, points1[i+n/2].anchor];
line1.setEntirePath(points2);
}
polygon1.remove();
... View more
Jan 15, 2021
10:59 AM
3 Upvotes
Further to what @CarlosCanto said ... // referencing items on artboard
var list = "";
for (var i = 0; i < activeDocument.artboards.length; i++) {
activeDocument.artboards.setActiveArtboardIndex(i);
activeDocument.selectObjectsOnActiveArtboard();
for (var j = 0; j < selection.length; j++) {
list = list + activeDocument.artboards[i].name + " - " + selection[j].name + "\r";
}
}
alert( list );
... View more
Jan 13, 2021
03:23 AM
Thanks femkeblanco, that's helpful.
... View more
Jan 10, 2021
07:52 PM
a que te refieres con "combinarlos"?
... View more
Jan 10, 2021
08:47 AM
Hi femkeblanco, thank you for your reply! I tried to automatically convert my (nested) paths to compound paths using the "Pathfinder Tool" but I couldn’t find a convenient method (some of the paths disappear when converting, which is expected behavior). And to answer your question: No, my existing script doesn’t work on compound paths (I didn’t really investigate why…). Anyway, your reply inspired me to adapt my existing script, unfortunately I encountered a new problem: “How to check if a shape is inside another curved shape?” I’ll post a new ticket. Thanks again, kind regards!
... View more
Jan 09, 2021
10:48 PM
I can't reproduce that problem. Any chance you could you post screenshot of layers palette, or link to sample file?
... View more
Jan 04, 2021
01:18 PM
1 Upvote
Thank you @pixxxelschubser ! I'm in over my head as usual. My test file had all named objects so I missed that fact.
I did notice if I changed a Symbol Instance to the SAME name as the original Symbol the object was skipped. Guess AI cannot tell the difference between a manually typed name and the original generic Symbol name.
Edit: So, if one wished to capture the "default" names given to objects in a document is that possible?
... View more
Jan 02, 2021
06:41 AM
Got it. Thanks a lot!
... View more
Jan 02, 2021
02:09 AM
Hi there,
Thanks for reaching out. In addition to response given above, please check out this help article(https://helpx.adobe.com/illustrator/how-to/draw-and-align-vector-artwork.html) to know how to work with guides on the app.
Hope it helps.
Regards,
Ashutosh
... View more
Dec 30, 2020
07:31 PM
1 Upvote
// place a specific Artboard from an ai doc
var idoc = app.activeDocument;
var pdfOptions = app.preferences.PDFFileOptions;
pdfOptions.pageToOpen = 4; // it works for Artboards since placing an ai file places the pdf version
var iplaced = idoc.placedItems.add();
iplaced.file = File( '/c/...full path.../your file.ai');
... View more
Dec 30, 2020
12:33 PM
Is TEST1 (or TEST2) the whole (only) contents - or only a part of the contents of the textFrame in your layer?
Are there any other textFrames in the corresponding layers?
... View more
Dec 28, 2020
07:44 AM
Thanks. Yes, in JavaScript two objects are not equal, even if they possess the same properties and values, unless they refer to the same object.
... View more
Dec 26, 2020
11:03 AM
Thanks for your answer. As expected, there is no way to handle mesh envelope diatort. I will definitely try to use meshtormentor for my needs. There is only russian language guide. Thanks
... View more
Dec 25, 2020
01:36 PM
Thsnks, it works!!
... View more
Dec 23, 2020
01:02 AM
Hello Barbara, thank you. Unfortunatelly Stroke panel seems only affect the visualization, I need to change/check the path itself. About the change the shape, yes, that is the idea, but I would like to make an final verification
... View more
Dec 19, 2020
10:25 AM
1 Upvote
Not what you asked for but... var frames = app.activeDocument.textFrames;
var window1 = new Window("dialog", "Cap height");
var group1 = window1.add("group");
var button1 = group1.add("button", undefined, "↑");
var button2 = group1.add("button", undefined, "↓");
var scale = function (addend) {
for (var i = 0; i < frames.length; i++) {
var chars = frames[i].textRange.characters;
for (var j = 0; j < chars.length; j++) {
if (/[A-Z]/.test(chars[j].contents)) {
chars[j].characterAttributes.verticalScale = chars[j].characterAttributes.verticalScale + addend;
redraw();
}
}
}
}
button1.onClick = function () {scale(10)}
button2.onClick = function () {scale(-10)}
window1.show (); You could try calculating the addend (a percentage) from millimeters, which in turn you calculate from points, but given my ignorance of typeface anatomy I will not attempt this.
... View more
Dec 15, 2020
12:08 PM
Yes. The script should work.
For pathItems!
try this part of your script with an opened document with a few PATHITEMS
var fillRGBColor = function (pathItems, r, g, b){
for (var i=0; i < pathItems.length; i++) {
pathItems[i].fillColor.red = r;
pathItems[i].fillColor.green = g;
pathItems[i].fillColor.blue = b;
}
}
//fillRGBColor(app.activeDocument.pathItems, 50, 50, 50); // dark grey
fillRGBColor(app.activeDocument.pathItems, 255, 255, 0); // yellow
... View more