Question
How to solve: images don't update automatically after opening and modifying them in ps with a script
Holle! m1b everyone
This script opens the image in Ps, but the image in the ID is not updated after the changes are saved. It's a bit of a workload to update hundreds of images manually.
Is there any way to solve it?
Thank you very much.
I came across this posting and it's a bit too long to read.
another post

/**
* Open Selected Links In Photoshop.js
*
* Opens the selected linked file(s) in Photoshop.
*
* m1b
* 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.
* m1b
* 2025-03-08
* {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.
* {String} paths - the paths, delimited.
* {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]));
};
