Scripting Windows: Add page item after add swatch will delete added swatch
In ExtendScript on Windows only, adding any InDesign page item after adding a color will delete the color:
var doc = app.documents.add();
// adds black CMYK color
sw = doc.colors.add();
// this line will delete the color that was just added on Windows only
var rect = doc.rectangles.add();
alert(sw.isValid);
This actually manifested for me as a crash bug. This script crashes InDesign 2024 Windows:
var doc = app.documents.add();
var sw = doc.colors.add();
doc.rectangles.add({fillColor: sw});
This crashes because the last line deletes the swatch when it adds the rectangle, then tries to use the swatch.
1
vote
Lawrence Horwitz
shared this idea