This is not something I've ever done, but have you tried setting the aliasInkName property of the ink (in the document inks collection)?
myInk = myDocument.inks.item("PMS 295");
myInk.aliasInkName ="PANTONE 295 C";
Thank you DaveSofTypefi. I've marked the answer as correct, but it needed one tweak: change the myDocument to app.activeDocument
app.activeDocument.importAdobeSwatchbookSpotColor ("PANTONE 295 C"); myInk = app.activeDocument.inks.item("PMS 295"); myInk.aliasInkName ="PANTONE 295 C";
otherwise it's all good
@Colly – sometimes we use descriptive variables to illustrate something. The "my" in the name is always an indication, that a variable is in play, that has to be defined elsewhere… We could debate now, if that is "good style" or not, but no. I don't do that right now ;-)
It's kind of "dummy" code and not meant to work immediately.
In the case of "myDocument", you could use an additional line of code to define the variable "myDocument" at the start of the snippet and leave all other incidences of "myDocument" unchanged in the code:
var myDocument = app.activeDocument;
or you work with index 0 in an array like fashion:
var myDocument = app.documents;
or in a collection like fashion ("documents" is a collection of single document objects, and if you want to point out that to you, use the following syntax):
var myDocument = app.documents.item(0);
or you could have worked with the name of an open document (amongst others):
var myDocument = app.documents.itemByName("MyDocumentName.indd");
There are other examples as well…
thank you for the explanation.
the only reason that I mentioned the change in my script is that if I was to purely cut and paste dave's script and put it into my script, it wouldn't work until myDocument was defined. this is par for the course for those familiar with scripting, but for users with little or no scripting experience who are looking for a script that will work now with little intervention, they may not be aware of this extra instruction.
nevertheless, the script does what I need it to do and I hope it can help others in similar situations.