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

Initiating a script from a created menu

Community Beginner ,
May 07, 2013 May 07, 2013

Copy link to clipboard

Copied

Ok,

I admit that I am a novice with JavaScript, although I have experience developing using Xcode with ObjC and lots of interapplication scripting with AppleScript.

However, I am clearly missing some very basic concepts trying to do some very simple things to script Adobe Bridge.

For instance, I have followed the tutorials and have had no problem running and customizing versions of SnpAddMenuItem.jsx and SnpCreateThumbnailInspector.jsx.

Now, let's say I put the SnpAddMenuItem.jsx in the Startup Scripts folder for Bridge CS6. (works fine and creates menu on launch.)

However, instead of displaying an alert, as in the demo:

alertCommand.onSelect = function (m)

    {

        var txt = m.text;

        // Display result as UI, as this is UI sample

        alert("'" + txt + "' was chosen menu item");

        // run javascript

        //SnpCreateThumbInspectorPanel.Main();

    }

I want to run  SnpCreateThumbnailInspector.jsx.

Do I:

  1. Call the script by referencing it's location on disk
  2. Include the CreatThumbnailInspector code as a function in the AddMenuItem script and direct function.OnSelect to run that function
  3. Or is there some other method that I am totally missing?

I have scoured the documentation and much of the sample scripts and can't seem to figure out this seemingly simple concept.

- James


TOPICS
Scripting

Views

930

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
Valorous Hero ,
May 07, 2013 May 07, 2013

Copy link to clipboard

Copied

Most of the examples are written to be executed from within ExtendScript Toolkit, the supplied IDE.

Just open the script in ExtendScript Toolkit and run it with Bridge as the target.

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 Beginner ,
May 13, 2013 May 13, 2013

Copy link to clipboard

Copied

Well...

I'm trying to build a utility that will be used by multiple users, not a one-off 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
Valorous Hero ,
May 13, 2013 May 13, 2013

Copy link to clipboard

Copied

There should be many examples here on the forum, here is one that you can play with...

#target bridge  

if( BridgeTalk.appName == "bridge" ) { 

var menu = MenuElement.find ("myNewBridgeMenu");

if (menu == null){

var newMenu = MenuElement.create( "menu", "My Bridge Scripts", "before tools/ps", "myNewBridgeMenu" );

WhatEverYouWant = MenuElement.create( "command", "Test Script", "at the end of myNewBridgeMenu",  "BridgetestScript" );

    }

}

WhatEverYouWant.onSelect = function () {

    alert("This is my new 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
Explorer ,
May 16, 2013 May 16, 2013

Copy link to clipboard

Copied

LATEST

If I understand you correctly it's 2.

Stick you function in the onSelect event of the item.

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