Copy link to clipboard
Copied
Can a Photoshop script bring another application to the front after the script content has been executed?
For example call Bridge, the OSX Finder, or a web browser to the front?
I am not sure what is the correct way to call another application from a Photoshop script.
Should it be treated as running an external file?
var targetApp = app.bringToFront('Adobe Bridge 2021');
if(targetApp){alert("Br test");}
You can't alert by Extendscript in non Adobe apps, but at least on Windows you can bring them to front. Just try if it works on Mac as well. If so you can change path to the executable file for OSX Finder.
File(Folder.desktop).execute()
For Adobe apps use:
BridgeTalk.bringToFront('bridge');
(bt = new BridgeTalk()).target = 'bridge'
bt.body = 'alert("Hello!")', bt.send()
Copy link to clipboard
Copied
You can't alert by Extendscript in non Adobe apps, but at least on Windows you can bring them to front. Just try if it works on Mac as well. If so you can change path to the executable file for OSX Finder.
File(Folder.desktop).execute()
For Adobe apps use:
BridgeTalk.bringToFront('bridge');
(bt = new BridgeTalk()).target = 'bridge'
bt.body = 'alert("Hello!")', bt.send()
Copy link to clipboard
Copied
One last issue that I did not see when I posted the question.
How should I modify the snippet to deselect the thumbnails in Bridge?
The edit I made is not working.
BridgeTalk.bringToFront('bridge');
(bt = new BridgeTalk()).target = 'bridge'
bt.body = 'app.document.deselectAll()', bt.send()
Copy link to clipboard
Copied
Clarification, the snippet does work by deselecting the thumbnails in the Bridge app.
After it deselecting the thumbnails, the snippet brings Photoshop to the foreground instead of making Bridge the front application.
Can the snippet prevent Photoshop from becoming the front application?
Copy link to clipboard
Copied
In my case it does not bring Photoshop back to front after deselecting thumbnails in Bridge.
Copy link to clipboard
Copied
I tried your snippet and for me it works - it deselects thumbnails in Bridge.
Copy link to clipboard
Copied
Good to know thank you!
Copy link to clipboard
Copied
You can run any command line command from Photoshop with app.system()
open /Applications/Safari.app
Copy link to clipboard
Copied
you can use this code to launch and any app or HTM file
// Launch safari Application
var targetApp = new File('/Applications/Safari.app');
if (targetApp.exists) {
targetApp.execute();
}
//Validate that the file exists
if (!targetApp.exists) {
if (DialogModes.NO != app.playbackDisplayDialogs) {
alert("Can't find Safari in your applications folder!");
}
return 'cancel'; // quit, returning 'cancel'
}
Copy link to clipboard
Copied
My Scripts dialog Help button is ans example
buttonPanel.helpBtn.onClick = function() {help();}
function help() {
try{
var URL = new File(Folder.temp + "/PhotoCollageToolkit.html");
URL.open("w");
URL.writeln('<html><HEAD><meta HTTP-EQUIV="REFRESH" content="0; url=http://www.mouseprints.net/old/dpr/PhotoCollageToolkit.html"></HEAD></HTML>');
URL.close();
URL.execute();
}catch(e){
alert("Error, Can Not Open.");
};
}
Copy link to clipboard
Copied
Thank you all for your suggestions and contributions. It is useful to know differnt options to call an external application from a Photoshop script.