Is it possible to assign and embed a color profile with an Action or script and no user interaction?
Copy link to clipboard
Copied
Hello.
We need to be able to assign and embed the color profile associated with the current Color Settings for a given file and ensure it is included when (re)saving in AI format. This needs to happen hands off in a high-volume environment.
We have tried many different approaches to creating Actions that would do this, as well as exploring scripting this functionality.
However nothing we have been able to come up with actually assigns and/or embeds the color profile.
I'm hoping some of the scripting gurus on this list can advise if this kind of functionality is even possible within Illustrator using scripting or scripted Actions. Thanks in advance for any pointers or guidance you mnight be able to provide.
Explore related tutorials & articles
Copy link to clipboard
Copied
I've never done this, but I wondered if you could save documents as pdf first (with PDFSaveOptions.preserveEditability set), using the PDFSaveOptions.colorProfileID property or the PDFSaveOptions.destinationID property and then re-saving as Illustrator document with IllustratorSaveOptions.embedICCProfile set to true.
Far fetched I know and you may have tried already.
Mark
Copy link to clipboard
Copied
It would make sense that embedICCProfile would do the job, even without the other things.
But I've never done this, so I'd be interested to know whether it works and satisfies this question.
Copy link to clipboard
Copied
Thanks for the response. If there is a profile assigned to the file, embedICCProfile does work. Our issue is that none of the incoming files has any profile attached and changing the document's color settings with a script doesn't explicitly assign a color profile. That's the missing mechanism we cannot find out how to do, either with an Action or in a script.
Copy link to clipboard
Copied
I wonder if the settings in Edit > Assign Profile would have an effect of doing what you need?
Copy link to clipboard
Copied
Thanks for following up.
Yes if we assign a profile in that dialog *manually* we are able to include the profile when scripting the SaveAs function.
Copy link to clipboard
Copied
Just to follow up to my last response, the problem we are encountering is that we will not be able to have any manual interaction with the files, so the profile assignment needs to happen programmatically, not based on any user actions.
Thanks.
Copy link to clipboard
Copied
Maybe someone really advanced could potentially insert the profile into the file without any interaction, but for your immediate solution you could benefit from AppleScript on Mac or AutoHotKey on Windows to press this button automatically.
Copy link to clipboard
Copied
Thanks for the reply.
Yes, we've tried going to PDF and back, but without a color profile already assigned to the document, nothing gets included.
Copy link to clipboard
Copied
Hmm, that makes things hard. As a last resort, perhaps you could clone the artwork into a new file based on a template that *does* contain the ICC profile? Via script you would also have to match artboard sizes and other things.
Copy link to clipboard
Copied
going by the suggestions above, here's a vbs that simulates a user assigning a profile. The script can be installed and be included in an action.
it goes without saying, this is windows only. Also, sendkeys command is mighty unpopular, it could wreck chaos very easily...but it works if supervised
Set objShell = CreateObject("WScript.Shell")
objShell.sendkeys "%ea"
objShell.SendKeys "%w"
objShell.SendKeys "{Enter}"
Copy link to clipboard
Copied
Hi Carlos
Apologies for the delayed reply, but I've just been able to return to this part of our larger implementation. Thank you for your reply.
Your VB script works flawlessly everytime when placed in the Scripts folder and attached to an Action that is manually invoked within the program. Thank you for that.
However when we try to call that Action from outside Illustrator, the Action does not invoke correctly and does not choose the Working Space option in the Assign Profile... dialog. It also doesn't work if we try using it within a JSX script that executes the .vbs script separately using execute().
Is there possibly some security setting somewhere that needs changing to allow the VB script to run properly when called via a .jsx script using app.doScript() or execute()?
Thansk again.
Copy link to clipboard
Copied
See if you are experiencing a script-action interoperability issue as determined in this thread: (https://community.adobe.com/t5/illustrator/running-action-with-script-not-working/td-p/11488634?page...)
The summary is that you can only play actions via scripts and scripts via actions but in a specific arrangement or it won't work.
Copy link to clipboard
Copied
Have you found a solution or are you using jg the VBS implementation?
I'm in search for sure mething likewise, though i need the script to be able to run on multiple OS's. On osx i can run os commands, did so in photoshop scripts already. My workaround for windows was also using VBS to stimulate a key press.
Issue is, i need to create a new document and have the new document have the same profile as the open one. We can use app.colorprofile, something like that, but that is only the general setting. If an open document is different from that, this trick won't work.
So why guess i need to test the VBS approach. Now i need to figure out how to send a color profile name to the VBS so it can call that in the assignPeofile menu command

