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

Photoshop script bring another application forward

Engaged ,
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

937

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

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

 

Votes

Translate

Translate
Adobe
LEGEND ,
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()

 

Votes

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

 

Votes

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
Engaged ,
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?  

 

 

 

Votes

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
LEGEND ,
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.

Votes

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
LEGEND ,
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.

Votes

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

Copy link to clipboard

Copied

LATEST

Good to know thank you!

Votes

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
LEGEND ,
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

Votes

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'

    }

 

Votes

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
Community Expert ,
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

Votes

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
Engaged ,
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.

Votes

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