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

How to open images with different default applications in InDesign and resource manager (Windows)?

Guide ,
Mar 04, 2025 Mar 04, 2025

In ID, when pressing Alt+double click, I want to open jpg, tif, PSD in PS by default.

 

However, in resource manager (Windows), I would like to default to Honeyview to open jpg, psd, tif when double clicking on an image. because I find Honeyview easier to look at the image.

 

Is it possible to realize?
Thanks.

TOPICS
Bug , Feature request , How to , Import and export , Scripting , Type
3.6K
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 2 Correct answers

Community Expert , Mar 06, 2025 Mar 06, 2025

I've added the part to manually insert your photoshop path

 

if (app.documents.length > 0 && app.selection.length > 0) {
    var sel = app.selection[0];
    var imageItem = null;

    // Check if the selection is an image directly
    if (sel.constructor.name === "Image") {
        imageItem = sel;
    } 
    // Otherwise, check if it's a frame containing an image
    else if (sel.hasOwnProperty("images") && sel.images.length > 0) {
        imageItem = sel.images[0];
    }

    if (imageItem && 
...
Translate
Community Expert , Mar 07, 2025 Mar 07, 2025

@Eugene Tyson this is an example of how I like to handle BridgeTalk calls. I write a function that I then convert to string using `Function.toSource()` then I call it inside an IIFE, adding parameters to the IIFE call (these must be strings too). (Edit: note that I don't actually invoke `toSource`—the function `openPaths` is impicitly coerced to a string by the `replace` method I used to construct the bt.body string.) This might seem a bit opaque at first but for me it avoids a lot of the messy

...
Translate
Community Expert ,
Mar 05, 2025 Mar 05, 2025

InDesign will use the systems File Association to open the image - so if you're computer is setup to open in Honeyview (whatever that is) then it will open the images from InDesign in Honeyview. 

 

A script and more info here

https://community.adobe.com/t5/indesign-discussions/script-that-opens-a-selected-indesign-image-in-p...

 

 

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
Guide ,
Mar 05, 2025 Mar 05, 2025

Thank you very much.
I really didn't realize that there are others who share the same hobby as me.

 

In fact, this code still doesn't open in PS ......
Rather, it opens in the default application in windows.

 

The qualification of having to use the white arrow is a bit self defeating.

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 ,
Mar 05, 2025 Mar 05, 2025

Try this

 

if (app.documents.length > 0 && app.selection.length > 0) {
    var sel = app.selection[0];
    var imageItem = null;
    
    // Check if the selection is directly an image
    if (sel.constructor.name === "Image") {
        imageItem = sel;
    }
    // Otherwise, if it is a rectangle (or any page item that can contain an image),
    // check if it has images inside.
    else if (sel.hasOwnProperty("images") && sel.images.length > 0) {
        imageItem = sel.images[0];
    }
    
    if (imageItem && imageItem.itemLink) {
        var filePath = imageItem.itemLink.filePath;
        openInPhotoshop(filePath);
    } else {
        alert("Please select an image or a frame that contains an image.");
    }
} else {
    alert("No document open or nothing selected.");
}

function openInPhotoshop(filePath) {
    try {
        var bt = new BridgeTalk();
        bt.target = "photoshop";
        bt.body = 'app.bringToFront(); app.open(new File("' + filePath + '"));';
        bt.send();
    } catch (e) {
        alert("Error opening image in Photoshop: " + e);
    }
}
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
Guide ,
Mar 05, 2025 Mar 05, 2025

No reaction.
Or could it be that it doesn't recognize the PS path, I have both versions of PS.
Is it possible to customize the PS path?

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 ,
Mar 05, 2025 Mar 05, 2025

Works for me 

 

Here's one with alerts built in to see what's going on for you 

 

function imagesToPS() {
    if (app.selection.length > 0) {
        var selectedPageItem = app.selection[0];
        alert("Selection detected: " + selectedPageItem.constructor.name);

        if (selectedPageItem.constructor.name === "Rectangle" || selectedPageItem.constructor.name === "Oval" || selectedPageItem.constructor.name === "Polygon") {
            if (selectedPageItem.graphics.length > 0) {
                var image = selectedPageItem.graphics[0];
                alert("Image detected inside frame: " + image.constructor.name);

                if (image.itemLink) {
                    var filePath = image.itemLink.filePath;
                    alert("File path detected: " + filePath);
                    openImageInPhotoshop(filePath);
                } else {
                    alert("Error: Image is embedded, not linked.");
                }
            } else {
                alert("Error: No image found inside the frame.");
            }
        } else {
            alert("Error: Selected item is not a valid image frame.");
        }
    } else {
        alert("Error: No items selected.");
    }
}

function openImageInPhotoshop(filePath) {
    try {
        var bt = new BridgeTalk();
        bt.target = "photoshop";
        bt.body = 'app.bringToFront(); app.open(new File("' + filePath + '"));';
        
        bt.onError = function (inBT) {
            alert("BridgeTalk Error: " + inBT.body);
        };

        bt.onResult = function (resObj) {
            alert("Photoshop command sent successfully.");
        };

        alert("Sending image to Photoshop...");
        bt.send();

    } catch (e) {
        alert("Error opening image in Photoshop: " + e);
    }
}

// Run the function
imagesToPS();

 

Alerts the name of the selected object.

 

Checks if it's a valid image container (Rectangle, Oval, or Polygon).


Checks if an image exists inside and alerts its type.


Checks if the image is linked and alerts the file path.


Alerts before sending the command to Photoshop and confirms if the script reaches that step.


If Photoshop receives the command, it sends a success message.



How to troubleshoot:
If you get "Error: No image found inside the frame", you might be selecting a frame without an image.
If you get "Error: Image is embedded, not linked", the image must be linked, not embedded.
If no alerts appear at all, the script isn't running or there's an InDesign issue.
If Photoshop doesn’t open the image, check for "BridgeTalk Error" to see what’s wrong.

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
Guide ,
Mar 06, 2025 Mar 06, 2025

Senting image to ps...... my ps not responding
Can I set my PS installation path?

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 ,
Mar 06, 2025 Mar 06, 2025

What's your Photoshop path link?

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
Guide ,
Mar 06, 2025 Mar 06, 2025

D:\Program Files\Adobe\Adobe Photoshop 2025\Photosho.exe

I have a bit too many versions installed, so I may have messed up

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 ,
Mar 06, 2025 Mar 06, 2025

I've added the part to manually insert your photoshop path

 

if (app.documents.length > 0 && app.selection.length > 0) {
    var sel = app.selection[0];
    var imageItem = null;

    // Check if the selection is an image directly
    if (sel.constructor.name === "Image") {
        imageItem = sel;
    } 
    // Otherwise, check if it's a frame containing an image
    else if (sel.hasOwnProperty("images") && sel.images.length > 0) {
        imageItem = sel.images[0];
    }

    if (imageItem && imageItem.itemLink) {
        var filePath = imageItem.itemLink.filePath;
        openInPhotoshop(filePath);
    } else {
        alert("Please select an image or a frame that contains an image.");
    }
} else {
    alert("No document open or nothing selected.");
}

function openInPhotoshop(filePath) {
    try {
        var bt = new BridgeTalk();
        bt.target = "photoshop";
        bt.body = 'app.bringToFront(); app.open(new File("' + filePath + '"));';
        var sent = bt.send();

        if (!sent) {
            throw new Error("BridgeTalk failed. Trying direct launch...");
        }
    } catch (e) {
        alert("BridgeTalk failed: " + e.message + "\nAttempting to open Photoshop manually...");

        // Manually launching Photoshop
        try {
            var photoshopPath = 'D:\\Program Files\\Adobe\\Adobe Photoshop 2025\\Photoshop.exe';
            var cmd = '"' + photoshopPath + '" "' + filePath + '"';
            app.doScript('var wsh = new ActiveXObject("WScript.Shell"); wsh.Run(' + JSON.stringify(cmd) + ', 1, false);', ScriptLanguage.JAVASCRIPT);
        } catch (manualError) {
            alert("Failed to launch Photoshop manually: " + manualError);
        }
    }
}
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
Guide ,
Mar 06, 2025 Mar 06, 2025

Hi. Eugene Tyson
Do I need to install Bridge? I don't have it.
Two prompts pop up. It's like the ps isn't being evoked.

001.png02.png

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 ,
Mar 07, 2025 Mar 07, 2025

No you don't need Adobe Bridge installed

 

Try changing 

bt.target = "photoshop";

 

to

bt.target = "photoshop-2025";

 

or whatever Year PS you have

 

var bt = new BridgeTalk();
bt.target = "photoshop-2025";
bt.body = 'app.bringToFront(); app.open(new File("' + filePath + '"));';
bt.send();
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
Guide ,
Mar 07, 2025 Mar 07, 2025

Same problem, seems like BridgeTalk() is not working well since ID 2024.

My other script also has BridgeTalk() , which used to work, but now it doesn't respond either.

 

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
Guide ,
Mar 07, 2025 Mar 07, 2025

Maybe there's something wrong with this paragraph.

var cmd = '"' + photoshopPath + '" "' + filePath + '"';

 

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 ,
Mar 07, 2025 Mar 07, 2025

I'm not sure why it's not working maybe @m1b has an idea - sorry I know there's more scripters but the handles are escaping me to tag them.

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
Guide ,
Mar 07, 2025 Mar 07, 2025

Thanks.
Really looking forward to him, the legendary great m1b, it's been a while.

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 ,
Mar 07, 2025 Mar 07, 2025

Hi @dublove and @Eugene Tyson, at a quick glance, the first problem I noticed is this line:

app.doScript('var wsh = new ActiveXObject("WScript.Shell"); wsh.Run(' + JSON.stringify(cmd) + ', 1, false);', ScriptLanguage.JAVASCRIPT);

 

The problem is that the JSON object is not available at runtime. You would need to //@include it. However there is no reason to stringify `cmd` which is already a String. So try just changing to

app.doScript('var wsh = new ActiveXObject("WScript.Shell"); wsh.Run(' + cmd + ')', ScriptLanguage.JAVASCRIPT);

 

See if that helps, but there seems to be other issues which I'll have a look at later if you still need help.

 

If you are using ExtendScript debugger with VSCode—you can use this line:

debugger;

at a point in your code where you want to check the contents of a variable. Then you run the code (from VSCode, not directly from Indesign). The debugger should pause at the "debugger" command and in the Debug Console in VSCode (your other best friend) you can type commands and receive outputs.

 

So just before your app.doScript, you could put "debugger;" and then when debugger paused at that breakpoint, in the Debug Console you could type "cmd" (and press return) and it will print out the contents of the "cmd" variable. And then you could copy/paste the command into a new script and test just that command in Photoshop or wherever and see what errors it's getting, and then go back and fix it in your main script.

- Mark

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
Guide ,
Mar 07, 2025 Mar 07, 2025

Hi @m1b  @Eugene Tyson 

I tested it.

ps There still doesn't seem to be any response.

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 ,
Mar 07, 2025 Mar 07, 2025

@Eugene Tyson this is an example of how I like to handle BridgeTalk calls. I write a function that I then convert to string using `Function.toSource()` then I call it inside an IIFE, adding parameters to the IIFE call (these must be strings too). (Edit: note that I don't actually invoke `toSource`—the function `openPaths` is impicitly coerced to a string by the `replace` method I used to construct the bt.body string.) This might seem a bit opaque at first but for me it avoids a lot of the messy string concatenation dance that goes on. It also means that I can literally test the Photoshop function `openPaths` directly in photoshop to make sure it works!

 

@dublove this is my attempt at a script to "Open Selected Images in Photoshop". It works for me on MacOS. Does it work for you on Windows?

- Mark

 

 

/**
 * @file Open Selected Links In Photoshop.js
 *
 * Opens the selected linked file(s) in Photoshop.
 *
 * @author m1b
 * @version 2025-03-08
 * @discussion https://community.adobe.com/t5/indesign-discussions/how-to-open-images-with-different-default-applications-in-indesign-and-resource-manager-windows/m-p/15197180
 */
(function () {

    if (0 === app.documents.length)
        return alert('Please open a document and try again.');

    var doc = app.activeDocument,
        items = doc.selection;

    if (0 === items.length)
        return alert('Please select a linked graphic frame and try again.');

    // collect paths for each selected item
    var paths = [];

    for (var i = 0; i < items.length; i++) {

        var item = items[i];

        // maybe user selected the image, not the frame
        if ('Image' === item.constructor.name)
            item = item.parent;

        if (
            !item.hasOwnProperty('graphics')
            || 0 === item.graphics.length
            || !item.graphics[0].itemLink
            || LinkStatus.NORMAL !== item.graphics[0].itemLink.status
        )
            // ignore anything we can't use
            continue;

        // first linked image is all we need right now
        paths.push(item.graphics[0].itemLink.filePath);

    }

    if (0 === paths.length)
        return alert('Please select a linked graphic frame and try again.');

    // open the paths in photoshop
    openPathsInPhotoshop(paths);

})();

/**
 * Opens the given `paths` in Photoshop.
 * @author m1b
 * @version 2025-03-08
 * @param {Array<String>} paths - the paths to open.
 */
function openPathsInPhotoshop(paths) {

    const DELIMITER = '###';

    var photoshop = BridgeTalk.getSpecifier("photoshop");

    if (!photoshop)
        return alert("Photoshop is not available.");

    // send script via BridgeTalk
    var bt = new BridgeTalk();
    bt.target = photoshop;

    // arrange the function inside an IIFE string,
    // and perform string replacements to insert
    // our variables
    bt.body = '(#FN#)("#P#","#D#");'
        .replace('#D#', DELIMITER)
        .replace('#P#', paths.join(DELIMITER))
        .replace('#FN#', openPaths);

    bt.onResult = undefined;
    bt.send(1000);

};

/**
 * Photoshop function to open the given `paths`.
 * Note: cannot use // style comments here because
 * of the way I stringify it.
 * @param {String} paths - the paths, delimited.
 * @param {String} delimiter - the string used to delimit `paths`.
 */
function openPaths(paths, delimiter) {

    app.bringToFront();

    /* make aray by splitting paths */
    paths = paths.split(delimiter);

    for (var i = 0; i < paths.length; i++)
        if (File(paths[i]).exists)
            app.open(File(paths[i]));

};

 

Edit 2025-03-08: fixed a bug, where I forgot to include the string delimiter. Oops!

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 ,
Mar 07, 2025 Mar 07, 2025

Hi @dublove, did you test my updated script? I refactored something at the last minute and stupidly forgot to finish it. If still no response, can you insert this line as the first line of `openPaths` function:

alert(paths+delimiter);

It would be good to know if even that part works.

- Mark

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
Guide ,
Mar 07, 2025 Mar 07, 2025

Just tried, same thing: Photoshop is not available.
Obviously, the path to Photoshop.exe is not recognized.
If it is recognized, PS will jiggle a bit and then it will show up on the front 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
Guide ,
Mar 08, 2025 Mar 08, 2025

@m1b  @Eugene Tyson  @rob day 

It seems like I'm mistaken.

The code still only opens as a windows default application

if (app.selection.length > 0) {
    var s = app.selection[0]; 
    if (s.constructor.name == "Image") {
        s.itemLink.editOriginal();
    } else {
        alert("Selected item is not an image.");
    }
} else {
    alert("No items selected.");
}

 

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
Guide ,
Mar 07, 2025 Mar 07, 2025

Hi m1b.

Thank you very much.

Tested, pop-up: “Photoshop is not available”
My PS is a bit unusual in that it requires a path to be specified.

Normally, Eugene Tyson's code is what should work.
It's just that mine is a bit special;

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 ,
Mar 07, 2025 Mar 07, 2025

@dublove so the sticking point is that BridgeTalk cannot get a specifier for Photoshop:

(function () {

    var photoshop = BridgeTalk.getSpecifier("photoshop");

    if (!photoshop)
        alert("Photoshop is not available.");

    else
        alert('Specifier = ' + photoshop);

})();

 

If this doesn't work, then something is wrong with your installation, which is beyond my limited knowledge.

- Mark

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
Guide ,
Mar 07, 2025 Mar 07, 2025

Yes, BridgeTalk does not perceive photoshop.
Need to set a specific path for photoshop.exe like Eugene Tyson did.

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