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

Converting RGB images in InDesign using Photoshop's 'Convert to Profile'

Participant ,
Jan 10, 2025 Jan 10, 2025

Hi,

 

I want my RGB images in InDesign to convert to CMYK using the Photoshop's 'Convert to Profile' method. I found this script on the net:

http://kasyan.ho.ua/indesign/swatch_color/convert_rgb_grayscale_images_to_cmyk.html

 

However, this script is using the Change Mode method, whereas I want the 'Convert to Profile' method to convert my images to CMYK along with an option to select the desired Colour Profile from the Dropdown list. Like we do in Photoshop > Convert to Profile > select destination profile.

 

Any suggestions.

TOPICS
Scripting
956
Translate
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

correct answers 1 Correct answer

Community Expert , Jan 16, 2025 Jan 16, 2025

Oops must have copied the wrong code

 

Try this for auto fetching

 

function getAvailableCMYKProfiles() {
    var profiles = app.colorSettings.workingSpaceCMYKList;
    return profiles;
}

function getCMYKProfile() {
    var profiles = getAvailableCMYKProfiles();
    if (profiles.length === 0) {
        alert("No CMYK profiles available.");
        return null;
    }
    return showDropdown(profiles);
}

function showDropdown(profiles) {
    var dialog = new Window("dialog", "Select CMYK Profile
...
Translate
Community Expert ,
Jan 10, 2025 Jan 10, 2025

Leave the images in InDesign as RGB. Convert the images with the PDF export to their output profile. There is no. Eed to convert them extra. 

Translate
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
Participant ,
Jan 10, 2025 Jan 10, 2025

Thanks, Willi, I know about this. But I also need this script as part of my job requirement. The client insist the images to be CMYK in InDesign itself. So, a workaround with JavaScript would be much appreciated.

Translate
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 ,
Jan 10, 2025 Jan 10, 2025

It seems like a Photoshop batch process would accomplish this, and make more sense to convert images prior to placing in Indesign.

Translate
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 ,
Jan 10, 2025 Jan 10, 2025

The client insist the images to be CMYK in InDesign itself.

 

Why?

 

Okay, fine, the client is always right, but this sounds like some old rule they learned like outlining all the text or double-spacing after all periods. Do what you have to, but some gentle education back up the chain is not always out of place.

 

And if you're supposed to do this extra, outdated and unnecessary level of work for no pay, it's not trivial.

Translate
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 ,
Jan 10, 2025 Jan 10, 2025

Charge him extra for old and unneeded workflows. Then he will learn it. Using RGB is not only easier it is more secure.

Translate
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
Participant ,
Jan 10, 2025 Jan 10, 2025

Would you be kind enough to provide me the code, please leave other things with me.

Translate
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 ,
Jan 10, 2025 Jan 10, 2025

I find it amusing that you ignore the advice and demand the help for something you can't do. There's a contradiction or two in there but I'll leave you to your dilemma.

Translate
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 ,
Jan 10, 2025 Jan 10, 2025

Make a batch in Photoshiop. What is the problem?

Translate
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 ,
Jan 10, 2025 Jan 10, 2025

The script you cite on Kasyan's site is an OK thing to do, but your request is a technically wrong thing to do. Neither is really necessary when you follow a holistic color management method from Photoshop on downstream to InDesign and on downstream to exporting the PDF file. Let the PDF-export do the conversion.

Mike Witherell
Translate
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 ,
Jan 10, 2025 Jan 10, 2025

And with less snark intended, I think this is a case where it really should be discussed with the client. Yes, there are times you do what you're told and what they want, but unless there's a very specific reason for this request, a little "expert correction" back up the chain is not out of line.

Translate
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 ,
Jan 10, 2025 Jan 10, 2025

As mentioned already by others

 

The best way to do this is a Batch Convert in Photoshop with an action - which can be performed on an entire folder of images. 

 

What I do is record the conversion in Photoshop, but save to a different folder say called CMYK images. 

Then you can Relink all images using the Links Panel sub menu - there's an option to point to a folder, so you don't have to relink all the images one by one. 

Keeping the same file name and format etc. 

 

What you'll have trouble with is things like PNG which are RGB only - so you'll need to batch convert these to TIFF or PSD format

Then you can use the Links Panel to relink to a new file Format which is in the Sub Menu - quite useful

 

This is far quicker and far more reliable. 

 

All this requires for your images to be located in the same folder to do the Batch Conversion. 

If the images are spread out over multiple folders then that makes it harder. 

 

I've had it before for a magazine where the author supplied all the images in folders Page 1>bunch of images Page 2>Bunch of images 

In each folder for each page they were called Image01.tif, Image02.tif --- in each folder the same file names. 

It was a nightmare. 

 

Anyway 

If the client wants all the images in CMYK in Indesign that's understandable, as you can see the CMYK colour directly in InDesign and manage the CMYK values. If you have as RGB and export to CMYK the values may shift depending (they still can with CMYK to CMYK --- but that's their problem)

I understand if they need complete control over CMYK values. 

 

A script would be good if the images are stored all over the place in different folders. 

But if not - then the Photoshop Batch Action is the easiest solution. 

 

Let us know if you need help setting it up. 

 

If you're still looking for a script maybe we can help with that - understandably if files are not all centrally located.

Translate
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
Participant ,
Jan 11, 2025 Jan 11, 2025

Opinios, opinions, and opinions, that's all I get here.

 

As I said, I know all these things.

I can simply open the images in Photoshop and do the conversion.

I am also aware of the Batch thing.

I know the importance of RGB images and converting them while exporting a PDF.

I know the difference between Change-Mode and Convert-to-Profile methods.

I know the usage and differences between JPG, PNG Tiff etc images.

I know this, I know that.............................................................................

 

What I was looking is a JavaSript which when executed from InDesign tracks all the RGB images and convert them to CMYK. The script from Kasyan's site is very useful and I'm able to modify it to use the 'Convert to Profile' method, and also able to create a manual color profile list. The modified version is working fine. Here are the excerpts:

"    if (psDoc) {" +
"        psDoc.convertProfile('" + profile + "', Intent.RELATIVECOLORIMETRIC, true);" +
"        psDoc.save();" +
"        psDoc.close(SaveOptions.SAVECHANGES);" +

 

function getCMYKProfile() {
    var profiles = [
    "Coated FOGRA39 (ISO 12647-2:2004)",
    "Coated FOGRA27 (ISO 12647-2:2004)",
    "Coated GRACoL 2006 (ISO 12647-2:2004)",
    "ISO Web Coated",

I was wondering if the script could auto fetch the profile list as Photoshop do, then my script is completed.


But I think, there's no one to sort my problem here.

 

Anyway, thanks for all your SUGGESTIONS.

Translate
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 ,
Jan 11, 2025 Jan 11, 2025

Yeh, I get your frustration, believe me, I do.

 

With over 25 years of experience in print design, all I can do is offer my expertise on best practices and how I’d personally tackle this kind of situation.

 

At the same time, it’s worth keeping in mind that these threads are archived, and others might stumble across this discussion in their searches. The information shared here whether it’s directly what you’re looking for or just a nugget of knowledge might still be useful to someone down the road.

 

Everyone here is genuinely trying to help and share insights. The reality is, we don’t know what you already know; we can only go off what you’ve asked.

 

If you could provide the full code of your modified script, it’d make it much easier to understand where you’re at and offer targeted refinements to help you complete it.

 

You’ve done an impressive job so far, and with a bit of collaboration, we can help you finish this off.

Translate
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 ,
Jan 11, 2025 Jan 11, 2025
quote

Opinios, opinions, and opinions, that's all I get here.


By
code_seeeeeker

 

That is also why we are here for. Thanks for letting us know you got our (correct!) opinions. Very kind of you.

Translate
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 ,
Jan 11, 2025 Jan 11, 2025

I'll just point out that you have not once given any reason, purpose or need for this action (Have pointedly avoided doing so, even) and just gotten exasperated when you weren't handed a working answer for your purposes. Sometimes... it's not that simple and feedback on the 'why' can help steer a discussion to a productive end.

Translate
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 ,
Jan 11, 2025 Jan 11, 2025
quote

I'll just point out that you have not once given any reason, purpose or need for this action (Have pointedly avoided doing so, even) and just gotten exasperated when you weren't handed a working answer for your purposes. Sometimes... it's not that simple and feedback on the 'why' can help steer a discussion to a productive end.


By James Gifford—NitroPress

Well, they said it's a requirement from their client. 

And they want a script to identify the RGB images and convert just those - I think. 

 

Clients want the craziest things. 

I believe a script is possible - so let's focus on the solution.

Hopefully they can post the full script of what they've worked so far so we can further enhance it for their needs.

 

All good - I get the frustration. 

Translate
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
Participant ,
Jan 13, 2025 Jan 13, 2025

Thanks, Eugene, for your understanding.

 

The problem becomes really frustrating when people are not ready to accept the correct processes. There are still so many people around who prefer to work in the old-fashioned manner. They strickly say, 'please follow instructions' and we're left with no choice. I think it will take decades for them to understand.

 

Here's is my modified script that works well on the selected image. I have list-down all the possible profiles in the 'getCMYKProfile()' function. The script is working fine, but if a particular profile is missing, then no conversion takes place. So, I was wondering, if the script can fetch the profile list like Photoshop do, then my script will be more productive.

photoshop.pngexpand image

function convert2CMYK() {
    var doc = app.activeDocument;
    var selection = doc.selection;

    if (!selection || selection.length === 0) {
        // No selection, process all images in the document
        var links = doc.links;
        for (var i = 0; i < links.length; i++) {
            var link = links[i];
            if (link.status === LinkStatus.NORMAL) {
                var image = link.parent;
                if (image.constructor.name === "Image" && image.space === "RGB") {
                    processImage(link);
                }
            }
        }
    } else {
        // Process selected items regardless of shape
        for (var j = 0; j < selection.length; j++) {
            var selectedItem = selection[j];
            if (selectedItem.constructor.name === "Image") {
                var selectedLink = selectedItem.itemLink;
                if (selectedLink && selectedLink.status === LinkStatus.NORMAL && selectedItem.space === "RGB") {
                    processImage(selectedLink);
                }
            } else if (selectedItem.images && selectedItem.images.length > 0) {
                for (var k = 0; k < selectedItem.images.length; k++) {
                    var nestedImage = selectedItem.images[k];
                    var nestedLink = nestedImage.itemLink;
                    if (nestedLink && nestedLink.status === LinkStatus.NORMAL && nestedImage.space === "RGB") {
                        processImage(nestedLink);
                    }
                }
            }
        }
    }

    UpdateAllOutdatedLinks();

    //===================== FUNCTIONS ===============================
    function processImage(link) {
        var newPath = DuplicateAndRenameFile(link.filePath);
        var profile = getCMYKProfile();
        if (profile) {
            CreateBridgeTalkMessage(newPath, profile);
            RelinkFile(link, newPath);
        } else {
            // alert("No CMYK profile selected. Conversion canceled.");
        }
    }


    function CreateBridgeTalkMessage(imagePath, profile) {
        var bt = new BridgeTalk();
        bt.target = "photoshop";
        bt.body =
            "(function() {" +
            "    var psDoc;" +
            "    app.displayDialogs = DialogModes.NO;" +
            "    psDoc = app.open(new File('" + imagePath + "'));" +
            "    if (psDoc) {" +
            "        psDoc.convertProfile('" + profile + "', Intent.RELATIVECOLORIMETRIC, true);" +
            "        psDoc.save();" +
            "        psDoc.close(SaveOptions.SAVECHANGES);" +
            "    }" +
            "    app.displayDialogs = DialogModes.ALL;" +
            "})();";

        bt.onError = function (errObj) {
            // alert("Error in BridgeTalk: " + errObj.body);
        };

        bt.onResult = function () {
            alert("Image successfully converted to CMYK!");
        };

        bt.send(30);
    }


    function UpdateAllOutdatedLinks() {
        var link, c;
        for (c = doc.links.length - 1; c >= 0; c--) {
            link = doc.links[c];
            if (link.status == LinkStatus.LINK_OUT_OF_DATE) link.update();
        }
    }

    function DuplicateAndRenameFile(filePath) {
        var file = new File(filePath);
        var folderPath = file.path;
        var fileName = file.name;
        var fileExtension = fileName.substring(fileName.lastIndexOf("."));
        var baseName = fileName.substring(0, fileName.lastIndexOf("."));
        var newFileName = baseName + "_C" + fileExtension;
        var newFilePath = folderPath + "/" + newFileName;

        var newFile = new File(newFilePath);
        if (file.copy(newFilePath)) {
            return newFilePath; // Return the path of the duplicated file
        } else {
            alert("Failed to duplicate and rename file: " + filePath);
            return filePath;
        }
    }

    function RelinkFile(link, newPath) {
        var newFile = new File(newPath);
        if (newFile.exists) {
            link.relink(newFile);
            link.update();
        } else {
            alert("Failed to relink file: " + newPath);
        }
    }

    function getCMYKProfile() {
        var profiles = [
            "Coated FOGRA39 (ISO 12647-2:2004)",
            "Coated FOGRA27 (ISO 12647-2:2004)",
            "Coated GRACoL 2006 (ISO 12647-2:2004)",
            "ISO Web Coated",
            "ISOnewspaper26v4",
            "Japan Color 2001 Coated",
            "Japan Color 2001 Uncoated",
            "Japan Color 2002 Newspaper",
            "Japan Color 2003 Web Coated",
            "Japan Web Coated (Ad)",
            "U.S. Sheetfed Coated v2",
            "U.S. Sheetfed Uncoated v2",
            "U.S. Web Coated (SWOP) v2",
            "U.S. Web Uncoated v2",
            "Uncoated FOGRA29 (ISO 12647-2:2004)",
            "US Newsprint (SNAP 2007)",
            "Web Coated FOGRA28 (ISO 12647-2:2004)"
        ];

        var profileName = showDropdown(profiles);
        return profileName;
    }



    function showDropdown(profiles) {
        var dialog = new Window("dialog", "Select CMYK Profile");
        dialog.orientation = "column";
        var dropdown = dialog.add("dropdownlist", undefined, profiles);
        dropdown.selection = 0;
        dialog.add("button", undefined, "OK", { name: "ok" });

        if (dialog.show() == 1) {
            return dropdown.selection.text;
        } else {
            return null;
        }
    }
}

convert2CMYK();

 

Translate
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
Participant ,
Jan 15, 2025 Jan 15, 2025

Any suggestions!!

Translate
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 ,
Jan 15, 2025 Jan 15, 2025

Read the answers and follow then. What else do ou expect.

Translate
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 ,
Jan 16, 2025 Jan 16, 2025

@code_seeeeeker

 

What is wrong with executing Photoshop Action - from within your script?

 

Translate
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 ,
Jan 15, 2025 Jan 15, 2025

You could try this - I don't have files to test it on but added some extra functionality that should work

 

Again I'm not the best at this - ceratinly not working blind as nothing to test with 

 

function convert2CMYK() {
    var doc = app.activeDocument;
    var selection = doc.selection;

    if (!selection || selection.length === 0) {
        // No selection, process all images in the document
        var links = doc.links;
        for (var i = 0; i < links.length; i++) {
            var link = links[i];
            if (link.status === LinkStatus.NORMAL) {
                var image = link.parent;
                if (image.constructor.name === "Image" && image.space === "RGB") {
                    processImage(link);
                }
            }
        }
    } else {
        // Process selected items regardless of shape
        for (var j = 0; j < selection.length; j++) {
            var selectedItem = selection[j];
            if (selectedItem.constructor.name === "Image") {
                var selectedLink = selectedItem.itemLink;
                if (selectedLink && selectedLink.status === LinkStatus.NORMAL && selectedItem.space === "RGB") {
                    processImage(selectedLink);
                }
            } else if (selectedItem.images && selectedItem.images.length > 0) {
                for (var k = 0; k < selectedItem.images.length; k++) {
                    var nestedImage = selectedItem.images[k];
                    var nestedLink = nestedImage.itemLink;
                    if (nestedLink && nestedLink.status === LinkStatus.NORMAL && nestedImage.space === "RGB") {
                        processImage(nestedLink);
                    }
                }
            }
        }
    }

    UpdateAllOutdatedLinks();

    //===================== FUNCTIONS ===============================
    function processImage(link) {
        var newPath = DuplicateAndRenameFile(link.filePath);
        var profile = getCMYKProfile();
        if (profile) {
            CreateBridgeTalkMessage(newPath, profile);
            RelinkFile(link, newPath);
        } else {
            // alert("No CMYK profile selected. Conversion canceled.");
        }
    }

    function CreateBridgeTalkMessage(imagePath, profile) {
        var bt = new BridgeTalk();
        bt.target = "photoshop";
        bt.body =
            "(function() {" +
            "    var psDoc;" +
            "    app.displayDialogs = DialogModes.NO;" +
            "    psDoc = app.open(new File('" + imagePath + "'));" +
            "    if (psDoc) {" +
            "        psDoc.convertProfile('" + profile + "', Intent.RELATIVECOLORIMETRIC, true);" +
            "        psDoc.save();" +
            "        psDoc.close(SaveOptions.SAVECHANGES);" +
            "    }" +
            "    app.displayDialogs = DialogModes.ALL;" +
            "})();";

        bt.onError = function (errObj) {
            // alert("Error in BridgeTalk: " + errObj.body);
        };

        bt.onResult = function () {
            alert("Image successfully converted to CMYK!");
        };

        bt.send(30);
    }

    function UpdateAllOutdatedLinks() {
        var link, c;
        for (c = doc.links.length - 1; c >= 0; c--) {
            link = doc.links[c];
            if (link.status == LinkStatus.LINK_OUT_OF_DATE) link.update();
        }
    }

    function DuplicateAndRenameFile(filePath) {
        var file = new File(filePath);
        var folderPath = file.path;
        var fileName = file.name;
        var fileExtension = fileName.substring(fileName.lastIndexOf("."));
        var baseName = fileName.substring(0, fileName.lastIndexOf("."));
        var newFileName = baseName + "_C" + fileExtension;
        var newFilePath = folderPath + "/" + newFileName;

        var newFile = new File(newFilePath);
        if (file.copy(newFilePath)) {
            return newFilePath; // Return the path of the duplicated file
        } else {
            alert("Failed to duplicate and rename file: " + filePath);
            return filePath;
        }
    }

    function RelinkFile(link, newPath) {
        var newFile = new File(newPath);
        if (newFile.exists) {
            link.relink(newFile);
            link.update();
        } else {
            alert("Failed to relink file: " + newPath);
        }
    }

    function getCMYKProfile() {
        var profiles = [
            "Coated FOGRA39 (ISO 12647-2:2004)",
            "Coated FOGRA27 (ISO 12647-2:2004)",
            "Coated GRACoL 2006 (ISO 12647-2:2004)",
            "ISO Web Coated",
            "ISOnewspaper26v4",
            "Japan Color 2001 Coated",
            "Japan Color 2001 Uncoated",
            "Japan Color 2002 Newspaper",
            "Japan Color 2003 Web Coated",
            "Japan Web Coated (Ad)",
            "U.S. Sheetfed Coated v2",
            "U.S. Sheetfed Uncoated v2",
            "U.S. Web Coated (SWOP) v2",
            "U.S. Web Uncoated v2",
            "Uncoated FOGRA29 (ISO 12647-2:2004)",
            "US Newsprint (SNAP 2007)",
            "Web Coated FOGRA28 (ISO 12647-2:2004)"
        ];

        var profileName = showDropdown(profiles);
        return profileName;
    }

    function showDropdown(profiles) {
        var dialog = new Window("dialog", "Select CMYK Profile");
        dialog.orientation = "column";
        var dropdown = dialog.add("dropdownlist", undefined, profiles);
        dropdown.selection = 0;
        dialog.add("button", undefined, "OK", { name: "ok" });

        if (dialog.show() == 1) {
            return dropdown.selection.text;
        } else {
            return null;
        }
    }
}

convert2CMYK();

What I'm trying to do

 

Selection Handling:

  • Full Document Processing: Processes all images in the document if no selection is made.
  • Selected Items: Processes only selected images or nested images within selected objects.

Image Conversion:

  • RGB Detection: Checks if the image is in RGB colour space before converting.
  • Photoshop Integration: Uses BridgeTalk to send instructions to Photoshop for profile conversion.

File Management:

  • File Duplication: Creates a duplicate file with _C appended to the filename before conversion, preserving the original.
  • Relinking: Relinks the duplicated and converted CMYK file back to the InDesign document.

CMYK Profile Selection:

  • Dropdown Interface: Allows users to select a CMYK profile dynamically using a dropdown menu.
  • Profile List: Provides a comprehensive list of predefined CMYK profiles.

Link Management:

  • Link Status Check: Ensures links are active and normal before processing.
  • Outdated Link Update: Updates any outdated links in the document after processing.

Error Handling:

  • Error Messages: Alerts users about issues such as failed duplication, relinking, or BridgeTalk errors.
  • Fallbacks: Prevents further steps if prerequisites like CMYK profile selection fail.

Additional Features:

  • BridgeTalk Customisation: Allows integration with Photoshop for automated conversion without user intervention.
  • User Feedback: Displays alerts to confirm the successful conversion of images.

 

Translate
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
Participant ,
Jan 16, 2025 Jan 16, 2025

Hi Eugene,

 

You have given me my code in return, there's no difference, the script is pulling the profile's list manually instead of auto-fetching.  I think this is not a doable task, so let's close this chapter here.

 

Anyway, thanks everyone for your time and suggestions!

Translate
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 ,
Jan 16, 2025 Jan 16, 2025

Oops must have copied the wrong code

 

Try this for auto fetching

 

function getAvailableCMYKProfiles() {
    var profiles = app.colorSettings.workingSpaceCMYKList;
    return profiles;
}

function getCMYKProfile() {
    var profiles = getAvailableCMYKProfiles();
    if (profiles.length === 0) {
        alert("No CMYK profiles available.");
        return null;
    }
    return showDropdown(profiles);
}

function showDropdown(profiles) {
    var dialog = new Window("dialog", "Select CMYK Profile");
    dialog.orientation = "column";
    var dropdown = dialog.add("dropdownlist", undefined, profiles);
    dropdown.selection = 0;
    dialog.add("button", undefined, "OK", { name: "ok" });

    if (dialog.show() == 1) {
        return dropdown.selection.text;
    } else {
        return null;
    }
}
Translate
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
Participant ,
Jan 16, 2025 Jan 16, 2025

Thanks a ton, Eugene, this is really what I was looking. The code now picks up the profile's list from the system but there's a glitch, everytime, I add a new profile, I have to restart my InDesign. Furthermore, the script is not converting any image to CMYK, it just open it in the Photoshop. I think I can figure it out.

 

Thanks again for your time and support on this.

Translate
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