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

Add keyboard shortcuts or items in bar

Explorer ,
Oct 02, 2016 Oct 02, 2016

Is it possible to add a shortcut to a script? I know how to put it in the menu (MenuElement.create) but I would also like to be able to run the script from a keyboard shortcut or a custom item in the application bar or the Path bar.

TOPICS
Scripting
628
Translate
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
Guide ,
Oct 02, 2016 Oct 02, 2016

I don't think there is an easy way for Bridge scripts.

The only way I can think of is to call a Photoshop script by a shortcut, and have the script call the Bridge script via BridgeTalk.

Translate
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
Enthusiast ,
Oct 06, 2016 Oct 06, 2016
LATEST

There is a (limited) way of adding shortcuts to Bridge.

In windows, I have managed to add them to specific iconbuttons on a UI panel I have created.

For example, adding a shortcut to a button that runs a script:

app.document.navbars.filesystem.top.visible = true; // if you don't wanto the menu to be visible, you can put this to false

app.document.navbars.filesystem.top.height = 40;

if (app.document.navbars.filesystem.top.length < 1) {

    var myBT = app.document.navbars.filesystem.top.add('iconbutton', [0,0,undefined,undefined], undefined, {style:"toolbutton"});

    myBT.size = [74,40];

    myBT.text = "My Button";

    myBT.fillBrush = myBT.graphics.newBrush(myBT.graphics.BrushType.SOLID_COLOR, [0.1, 0.1, 0.1, 1] );

    myBT.graphics.font = ScriptUI.newFont("Trebuchet MS",'regular',11);

    myBT.textPen = myBT.graphics.newPen(myBT.graphics.PenType.SOLID_COLOR, [189/255, 220/255, 215/255, 1], 1);

    myBT.onDraw = function (event) {

        with ( this ) {

            graphics.drawOSControl();

            if (event.mouseOver) {

                graphics.rectPath(0, 0, size[0], size[1]);

                graphics.fillPath(graphics.newBrush(graphics.PenType.SOLID_COLOR, [253/255, 79/255, 87/255,1]));

            } else {

                graphics.rectPath(0, 0, size[0], size[1]);

                graphics.fillPath(fillBrush);

            }

            if ( text ) {

                var mesure = graphics.measureString(text,graphics.font);

                graphics.drawString(text, textPen, (size[0]-mesure[0])/2, (size[1]-mesure[1])/2-1, graphics.font);

            }

        }

    }

    //

    myBT.onClick = function() {

        alert('$.evalFile(Folder.desktop+ "/my_script_to_run.jsx"); ');

    }

    //

    ////////////////////////////////////  this extends the right-mouse thumbnail menu at the end adding a prefix letter S, T. U, V, W, X, Y, Z (i used Z in this single example)

    if (MenuElement.find('myBt') == undefined ) { // the prefix fisrt letter is important to get what button you want to press

        var bt_Z = new MenuElement("command", "Z run my script", "at the end of Thumbnail", 'myBt');

    }

    bt_Z.onSelect = function () {

        app.document.navbars.filesystem.top.children[0].onClick(); // this runs the 1st button  on the top panel of Content

    }

}

How to trigger the shortcut?

Bridge can't help you. On windows you can intall a mouse control freeware tool. I use X-Mouse Button Control:

Then I create a listner within X-Mouse Button Control to Bridge application, selection my right-mouse button and the letter I want to add.

The limit is the number of mouse buttons you have available.

In the image I have assigned the middle button mouse to run my script >> just adding a Simulated Keys (release) putting the code: {RMB}X

RMB = right mouse button

Hope it helps!

Translate
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