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

javascript - open bridge to specific folder

Explorer ,
Oct 15, 2024 Oct 15, 2024

Copy link to clipboard

Copied

I have an Electron app and I want to have a button that opens a selected folder in bridge.

I can open Bridge from the button, but I can't figure out how to tell Bridge to open a specific folder.

 

Is it possible? I am using fairly old version of electron, but since it does open I don't think that is an issue. I feel like there is just a different way to pass in the folder.

 

here is what I have:

const openInBridge = (folderPath: string) => {
    const bridgePath = path.join(
      'C:/Program Files/Adobe/Adobe Bridge 2024/Adobe Bridge.exe'
    );

    shell.openExternal(`${bridgePath}`);
  };

I've tried passing in a path after the bridge path, also with -f then the path. 

Any ideas? 

TOPICS
Scripting

Views

157

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 ,
Oct 15, 2024 Oct 15, 2024

Copy link to clipboard

Copied

Electron apps are often dreck, unfortunately, neither Windows nor Mac and lacking support for native technology. I'm not sure if Bridge will accept COM or Apple Events but you'd need both if you are trying to make this cross-platform. Bridge can be scripted with ExtendScript or (in v15) UXP, but again I don't know how you pass a message from your app to 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
Explorer ,
Oct 15, 2024 Oct 15, 2024

Copy link to clipboard

Copied

thanks for the fast reply, I was hoping there was just some flag you could pass in for the path to open to but maybe not. 

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 ,
Oct 15, 2024 Oct 15, 2024

Copy link to clipboard

Copied

You could write your path to a text file and open that file with bridge, and then use the path variable. I suppose you could look at the SDK for answers.

https://developer.adobe.com/console/76580/servicesandapis/br

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 ,
Oct 15, 2024 Oct 15, 2024

Copy link to clipboard

Copied

with a little help from chat GPT I got it to work!

 

I was using shell.openExternal which was more for urls/browser stuff. It needs to be a child process:

 

 

import path from 'path';
import { execFile } from 'child_process';
const openInBridge = (folderPath: string) => {
    const bridgePath = path.join(
      'C:/Program Files/Adobe/Adobe Bridge 2024/Adobe Bridge.exe'
    );
    let f = folderPath;
    const originals = path.join(folderPath, 'zz-originals');
    // check if originals folder exists
    if (fs.existsSync(originals)) {
      f = originals;
    }
    execFile(bridgePath, [f], (error) => {
      if (error) {
        console.error(`Error opening Bridge: ${error.message}`);
      }
    });
  };

 

thanks for your quick replies and link, it didn't have the exact answer I needed but it did get me to drop the sdk into chatgpt and try something other than I had been doing and that got me to a solution, much appreciated!

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 ,
Oct 15, 2024 Oct 15, 2024

Copy link to clipboard

Copied

LATEST

Another option is using inter-application BridgeTalk to set a target directory path in Bridge. An example of a better-than-native feature for Photoshop where Browse in Bridge actually goes to the image:

 

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