Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Photoshop script bring another application forward

Contributor ,
Jul 19, 2021 Jul 19, 2021

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?

 
This is the general idea:

 

 

 

var targetApp = app.bringToFront('Adobe Bridge 2021');
if(targetApp){alert("Br test");}

 

 

 

TOPICS
Actions and scripting, macOS

Views

191

Likes

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

correct answers 1 Correct answer

Adobe Community Professional , Jul 20, 2021 Jul 20, 2021
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()

Likes

Translate

Translate
Adobe Community Professional ,
Jul 20, 2021 Jul 20, 2021

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()

 

Likes

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
Contributor ,
Jul 23, 2021 Jul 23, 2021

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()

 

Likes

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
Contributor ,
Jul 23, 2021 Jul 23, 2021

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?  

 

 

 

Likes

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
Adobe Community Professional ,
Jul 24, 2021 Jul 24, 2021

Copy link to clipboard

Copied

In my case it does not bring Photoshop back to front after deselecting thumbnails in Bridge.

Likes

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
Adobe Community Professional ,
Jul 24, 2021 Jul 24, 2021

Copy link to clipboard

Copied

I tried your snippet and for me it works - it deselects thumbnails in Bridge.

Likes

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
Contributor ,
Jul 24, 2021 Jul 24, 2021

Copy link to clipboard

Copied

LATEST

Good to know thank you!

Likes

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
Adobe Community Professional ,
Jul 20, 2021 Jul 20, 2021

Copy link to clipboard

Copied

You can run any command line command from Photoshop with app.system()

open /Applications/Safari.app

Likes

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
Explorer ,
Jul 20, 2021 Jul 20, 2021

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'

    }

 

Likes

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
Adobe Community Professional ,
Jul 20, 2021 Jul 20, 2021

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.");
	};
}
JJMack

Likes

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
Contributor ,
Jul 20, 2021 Jul 20, 2021

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.

Likes

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