andyf65867865
Engaged
andyf65867865
Engaged
Activity
Jan 28, 2025
12:19 PM
This happens when you do not eplicitely return a value from a script as a result and it's only related to ExtexdScript Toolkit.
... View more
Jan 28, 2025
09:10 AM
Why when running a script from the ExtexdScriptToolkit environment, the last line of output in the console looks like: “Result: undefined”?
... View more
Jan 18, 2025
02:11 AM
What version of Illustrator will getViewMode() work with ? I didn't find any info about getViewMode function.
... View more
Jan 18, 2025
01:26 AM
@sttk3 When you say the Window title you obviously mean a document window title? When I get the window title in JavaScript it does not include info about overprint preview. app.activeDocument.name //test.ai
... View more
Jan 18, 2025
12:01 AM
In Adobe Illustrator, is there a way to check the Overprint Preview status (it looks like Overprint Preview is a property of the document) through a script? I have tried catching an error if I try to re-enable it, however that does not work. try {
app.executeMenuCommand('ink');
alert("on");
} catch (e) {
alert("already enabled");
}
... View more
Jan 12, 2025
02:12 AM
1 Upvote
Indeed, I didn't immediately notice that you used the @ symbol, and it works. But the disadvantage of this method is that visually the commented line blends in with the rest of the comments.
... View more
Jan 12, 2025
01:50 AM
Well, commenting on a line is clearly not a solution to the problem...
... View more
Jan 11, 2025
11:42 PM
In Visual Studio Code in the jsx file on all lines where #include is used, it gives a problem and suggests using ‘;’ at the end of the line. What is causing this to happen?
... View more
Dec 25, 2024
12:32 AM
There is one layer in the file, on which there are a number of objects like in the picture. How to arrange these objects (from this layer) on separate layers in the same order as they are arranged? This way, each sub-object will be on a separate layer.
... View more
Nov 26, 2024
08:16 AM
When processing objects that were retrieved as 'doc.pathItems' I skip the ones that are - hidden - locked - are on a hidden layer - are on a locked layer However, the script still tries to process an object that is on a hidden layer, and gives an error when it does a item.selected = true; // inside of pasteSubtractOn() if (!item.locked && !item.hidden && !item.layer.locked && !item.layer.hidden){
pasteSubtractOn(item);
}
... View more
Nov 23, 2024
01:49 AM
Hi @m1b ADOBE ILLUSTRATOR SCRIPTING REFERENCE: JAVASCRIPT also you could find it in the Illustrator Scripting Guide Release 0.0.1
... View more
Nov 23, 2024
01:20 AM
What's the weird logic in ExtendScript's GrayColor definition? JavaScript Object Reference grayColor.gray description: “The tint of the gray. Range: 0.0 to 100.0, where 0.0 is black and 100.0 is white.” We know that in Illustrator grayscale 0 is white and vice versa. If you want to create white fill: point.fillColor = new GrayColor();
point.fillColor.gray = 0;
... View more
Nov 20, 2024
01:28 AM
Where does the sequence of commands and codes come from, such as in this line (this is just for example and this is the entry that is written to the .aia file when used in a script) ? "/version 3 /name [ 7 466c617474656e ] /isOpen 1 /actionCount 1 /action-1 { /name [ 20 466c617474656e205472616e73706172656e6379 ] /keyIndex 0 /colorIndex 0 /isOpen 1 /eventCount 2 /event-1 { /useRulersIn1stQuadrant 0 /... }" Is it possible to get such a line for the selected action from the action panel?
... View more
Nov 19, 2024
06:38 AM
After you execute the “FlattenTransparency” command on a selected object, normally that object remains selected. However, in the following case, two objects, left and right, form a group that will be selected after the script completes. The script pre-fills arrayNoFill, which contains one right clip group. Consequently, I expected that Flatten Transparency would not affect other objects. Why is this happening? var arrayNoFill = [];
...
alert("Found " + arrayNoFill.length + " unfilled clipping mask(s)."); // found 1
alert('active layer: ' + doc.activeLayer.name);
// at this point nothing selected
for (var i = 0; i < arrayNoFill.length; i++) {
arrayNoFill[i] = true;
}
#include "../path/flatten_transparency.jsx" For some reason at this point the green shape is also selected and it makes group with the Clip Group on the right. Here is an action string I found somewhere on the forum which I use here to flatten transaprenty: "/version 3 /name [ 7 466c617474656e ] /isOpen 1 /actionCount 1 /action-1 { /name [ 20 466c617474656e205472616e73706172656e6379 ] /keyIndex 0 /colorIndex 0 /isOpen 1 /eventCount 2 /event-1 { /useRulersIn1stQuadrant 0 /internalName (adobe_selectAll) /localizedName [ 10 53656c65637420416c6c ] /isOpen 0 /isOn 1 /hasDialog 0 /parameterCount 0 } /event-2 { /useRulersIn1stQuadrant 0 /internalName (ai_plugin_flatten_transparency) /localizedName [ 20 466c617474656e205472616e73706172656e6379 ] /isOpen 0 /isOn 1 /hasDialog 1 /showDialog 0 /parameterCount 5 /parameter-1 { /key 1920169082 /showInPalette 4294967295 /type (integer) /value 75 } /parameter-2 { /key 1919253100 /showInPalette 4294967295 /type (unit real) /value 300.0 /unit 592342629 } /parameter-3 { /key 1869902968 /showInPalette 4294967295 /type (boolean) /value 1 } /parameter-4 { /key 1869902699 /showInPalette 4294967295 /type (boolean) /value 1 } /parameter-5 { /key 1667463282 /showInPalette 4294967295 /type (boolean) /value 1 } } }" It turns out this action has adobe_selectAll – how to properly remove it from there without snagging the extra?
... View more
Nov 19, 2024
03:02 AM
1 Upvote
@jduncan "there are some wonky edge cases with clipping masks" I don't doubt it, I've noticed that it's not easy to deal with every possible situation involving clipping masks.
... View more
Nov 18, 2024
12:49 PM
There are two objects on the artboard: a simple rectangle on the left and a clipping group on the right. Inside the clipping group (which is created in the program with the command: Clipping mask -> Make) is a simple rectangle with a stroke. The clipping mask object has no fill! Both objects are just selected, it's not a group. I want to find clipping groups that have no fill, like the one shown on the right. However, this code finds two objects that fit this condition. Why not just one? var arrayNoFill = [];
for (var i = 0; i < newLayer.pageItems.length; i++) {
var item = newLayer.pageItems[i];
if (item.typename === "PathItem") {
continue;
}
if (item.typename === "GroupItem" && item.clipped) {
var clippingMask = null;
for (var j = 0; j < item.pageItems.length; j++) {
var subItem = item.pageItems[j];
if (subItem.clipping) {
clippingMask = subItem;
}
if (clippingMask) {
var hasFillColor = clippingMask.filled;
alert("Is filled clipping mask? — " + (hasFillColor ? "Yes." : "No."));
if (!hasFillColor) {
arrayNoFill.push(item);
}
}
}
}
}
if (arrayNoFill && arrayNoFill.length > 0) {
alert('arrayNoFill length:' + arrayNoFill.length);
} else {
alert('arrayNoFill is empty');
}
... View more
Nov 18, 2024
12:43 AM
If you make a new document with dimensions as in the original document, then the dimensions of the artboard do not match at all in the new document, how can this be handled? var sourceDoc = app.activeDocument; var newDoc = app.documents.add(DocumentColorSpace.CMYK); newDoc.artboards[0].artboardRect = sourceDoc.artboards[0].artboardRect;
... View more
Nov 16, 2024
08:48 AM
This is likely another of countless other bugs. Instead of activating the newLayer ref I've done newLayer.pageItems.length; and it gave me a correct value.
... View more
Nov 16, 2024
06:50 AM
In extend script, is the active layer the selected layer in the layers palette or not necessarily? In the document there was an active layer on the reference newLayer (with name Layer 1 copy). Then a temp layer was created on top. After working with the temp layer, it is shown in the layers palette as highlighted in blue - it is the active layer. Now we need to activate the previous layer newLayer again. To do this, I lock and hide the temp layer, and do: doc.activeLayer = newLayer; But even with the subsequent app.redraw();, the layer palette looks like newLayer is an inactive layer.
... View more
Nov 16, 2024
06:45 AM
there is no groups inside the clipping group in the above example - that's a correct note
... View more
Nov 16, 2024
12:31 AM
Hi @m1b I used a recursive function that counted the groups differently than the method you cited - obviously this is the reason for the difference in counts. But maybe you meant: "the extra group is the clipped group".
... View more
Nov 15, 2024
10:59 PM
You see a group that consists of: on the left is a regular rectangle, on the right is a clipping mask, in which the mask is the same rectangle as on the left, and inside the mask are three rectangles (squares): white, above it orange, and above the orange white with a blue border. Simple, right? The question is equally simple, how many groups are there from a scripting perspective? It would seem that the general group and the clipping group are just two groups. But Illustrator finds three groups. Let's simplify and ungroup the outer group. Now we have two separate objects: a rectangle on the left and a clipping mask (group) on the right. So there's one group, and Illustrator will agree with us on that. Question: where does the third group come from in the first case?
... View more
Nov 10, 2024
02:17 AM
@renél80416020Thanks for the comments, indeed one operator turns out to be unnecessary, forcing the for loop to run unnecessary times in the case of multiple outer groups. However, the compound path type is a separate type and it was not necessary to “parse” it. Also, note that the line `selection = null` should be followed with redraw otherwise it will not work correct.
... View more
Nov 09, 2024
08:14 AM
1 Upvote
The reason is that in Illustrator, clipping masks are also a group.
... View more
Nov 09, 2024
07:32 AM
Why this script doesn't end? The idea is to ungroup all the groups in the doc. var doc = app.activeDocument;
var exit;
while (true) {
exit = true;
app.executeMenuCommand("selectall");
var sel = doc.selection;
for (var i = 0; i < sel.length; i++) {
var item = sel[i];
if (item.typename === "GroupItem") {
app.executeMenuCommand("ungroup");
alert('ungrouped!');
exit = false;
break;
}
}
while (doc.selection.length > 0) {
app.executeMenuCommand('deselectall');
app.redraw();
}
if (exit) break;
}
alert('exit while loop');
... View more
Nov 09, 2024
01:17 AM
How do I click the circle icon on the current layer in the layers palette in a script?
... View more
Nov 08, 2024
03:39 AM
Strangely, an error appears when calling an action from a script. It was reported here that the error can occur due to wrong action name or if the action is selected. The reasons given have been double-checked and still this error. Perhaps there is some other reason? At the same time, launching this action from the action bar works without any issues. p.s. bugs are popping out of every crevice
... View more
Nov 02, 2024
02:37 AM
Using the hotkey for Eyedropper tool with the Text tool active and text selected replaces the text with “i”. Is there any trick to invoke the Eyedropper tool with a hotkey so that the selected text remains selected?
... View more
Nov 01, 2024
09:33 AM
Is there any trick to select Group Selection Tool using the same hotkey as for Direct Selection Tool?
... View more
Oct 30, 2024
05:58 AM
Is it possible to find a problem here? First, a spot color is created and assigned to the global variable spotWhite, which is used further in the wrapper script. But the problem is that if this color is not in the ai file, then everything is ok, but if such a spot is already in the file, then I get an error. // CustomSpot.jsx
var spotColor;
var spotWhite;
if (app.documents.length > 0) {
var doc = app.activeDocument;
for (var i = 0; i < doc.spots.length; i++) {
if (doc.spots[i].name === "W") {
spotColor = doc.spots[i];
break;
}
}
if (!spotColor) {
...
// creating new spot
} else {
alert('the color is present');
spotWhite = spotColor;
}
}
// wrapper file
#target Illustrator
#include "CustomSpot.jsx"
main();
function main() {
...
/*
in case there was no color W, everything works as expected
but when there is color W in the swatches it doesn't work
*/
item.fillColor = spotWhite; // error
...
} Got around this error by first deleting an existing spot with that name, but that doesn't explain the error shown, which looks like a bug.
... View more