• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Applescript InDesign delete used swatch replacing with "Unnamed Swatch"

New Here ,
Mar 04, 2020 Mar 04, 2020

Copy link to clipboard

Copied

Hi Experts,

 

I am working on a project to delete all the swatches from an InDesign document using Applescript. I need to delete every swatch (not only the unused ones). If I delete the swatches from the InDesign User Interface (in the program itself), it asks me if I want to replace the swatch with some other defined swatch or I want to use "Unnamed Swatch". If I select "Unnamed Swatch" then it deletes the swatch and keeps the color intact, which is fine, that is exactly that I would like to do with Applescript as well. But when I try to delete the swatches from Applescript (to process hundreds of documents one by one), I cannot get access to this "Unnamed Swatch".

 

Below I copy the code I did so far:

 

tell application "Adobe InDesign 2020"

  set mydocument to active document

  tell mydocument

    set coloroptions to swatches

      repeat with co from 1 to count of items of coloroptions

        try

          delete item co of coloroptions without replacing

        end try

      end repeat

  end tell

end tell

 

Could you please advice me, how to move forward?

Thank you in advance

Ravast

TOPICS
Scripting

Views

415

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 13, 2020 Mar 13, 2020

Copy link to clipboard

Copied

I just wanted to chime in and say, that I fiddled around with Applescript and swatches and didnt got any news for you. 

It seems, that there is now option ("with replacing") to turn on to do exactly that.

What I found were scripts, that cycle thru all page items and change fill/stroke to new swatch, before deleting the old one. But i guess swatches can be used in many places, so that catching 'em all is difficult withing e.g. in objectstyles and whatnot.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 13, 2020 Mar 13, 2020

Copy link to clipboard

Copied

Hi Ravast,

basically you cannot delete a used color in InDesign.

If you do this as you say in the user interface there are still unnamed swatches in the document one can easily get by using the appropriate menu command.

 

So what you like to do is changing all named swatches to unnamed ones.

Years ago in the old InDesign Scripting forum we discussed how to add unnamed swatches to a document.

If you can do this you also can find a substitution for every named one while removing it.

 

We discussed this for ExtendScript scripting, but I hope you can transfer our findings for AppleScript as well.

 

One solution was to open InDesign's "Color Panel" for RGB, LAB or CMYK colors. That would automatically add an unnamed color with the right color space. You then can fetch the color and change the values according to your needs.

 

The other solution was to inject a new unnamed color by using Tagged Text. Trevor is showing this with his reply that is marked as "Correct".

 

A third solution was to use a IDMS snippet for this that one can place.

 

Coloring a Font with a RGB etc. without adding the color to the document swatches.
Trevor_, Adobe Community Professional , Sep 21, 2011

This link goes to my reply where I tested the solution with invoking the "Color Panel" that was provided by Jarek:

https://community.adobe.com/t5/indesign/coloring-a-font-with-a-rgb-etc-without-adding-the-color-to-t...

 

Regards,
Uwe Laubender

( ACP )

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 13, 2020 Mar 13, 2020

Copy link to clipboard

Copied

LATEST

asks me if I want to replace the swatch with some other defined swatch or I want to use "Unnamed Swatch". If I select "Unnamed Swatch" then it deletes the swatch and keeps the color intact, which is fine, that is exactly that I would like to do with Applescript as well.

 

What would be the point of removing the swatches that are being used without replacing? If the color is process it wouldn’t change the output—all of the objects using the now Unnamed Swatch would keep the same color definitions. If it is a Spot color the Unnamed Swatch is converted to Process, but that could be done via Ink Manager or Swatch Options’ Color Type without deleting the swatch.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines