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

[JS] Menu Added via Scripting Moves

Community Expert ,
Dec 16, 2011 Dec 16, 2011

Copy link to clipboard

Copied

I've been able to sucessfully add items to the InDesign menu thanks in part to Marijan Tompa's (tomaxxi) blog post http://indisnip.wordpress.com/2010/08/08/create-customized-menu/

My test code (below) creates a new menu, and sucessfully adds two menu items plus a submenu. The submenu is causing me problems. When you first launch InDesign it's created in the proper place (in the middle of the menu). But when you relaunch InDesign, the submenu moves to the top of the menu and never goes back to it's proper position farther down in the menu where it was the first time InDesign was launched.

I've searched high and low in this forum, the web and InDesign's documentation and can't figure out how to keep it from moving (I want the menu to be farther down the menu, not at the top). I hope one of you kind souls will help me to control the position of the submenu (and have it stay there across launches).

Thanks in advance!

Dan

Here's the code I'm working with. This is saved as testMenu.jsx in the Scripts > startup scripts folder.

P.S. I'm testing this in CS5.5 currently, but ideally this solution should work in CS3 and later.

#targetengine "myTestMenu"

var myFolder = Folder(app.activeScript.path);

myFolder = myFolder.parent + '/Scripts Panel/';

var menuItem1Handler = function( /*onInvoke*/ ){

  app.doScript(File(myFolder + 'MyTest1.jsx'));

};

var menuItem2Handler = function( /*onInvoke*/ ){

  app.doScript(File(myFolder + 'MyTest2.jsx'));

};

menuInstaller()

function menuInstaller() {

  var menuItem1T = "My Menu Item 1",

       menuItem2T = "My Menu Item 2",

       menuT = "MyTestMenu",

             subT = "Sub Menu",

       subs = app.menus.item("$ID/Main").submenus, sma, mnu;

  var refItem = app.menus.item("$ID/Main").submenus.item("$ID/&Layout");

  subMenu1 = app.scriptMenuActions.item(menuItem1T);

  if( subMenu1 == null ) {

          subMenu2 = app.scriptMenuActions.add(menuItem1T);

  }

  subMenu2 = app.scriptMenuActions.item(menuItem2T);

  if( subMenu2 == null ) {

          subMenu2 = app.scriptMenuActions.add(menuItem2T);

  }

  subMenu2.eventListeners.add("onInvoke", menuItem2Handler);

  mnu = subs.item(menuT);

  if( mnu == null ) {

            mnu = subs.add(menuT, LocationOptions.after, refItem);

  }

  mnu.menuItems.add(subMenu1);

  mnu.menuSeparators.add();

  subsSubs = app.menus.item( '$ID/Main' ).submenus.item( menuT ).submenus;

  mnuSubMenu = subsSubs.item( subT );

  if( mnuSubMenu == null ) {

          mnuSubMenu = subsSubs.add( subT);

  }

  mnu.menuItems.add(subMenu2);

};


— Adobe Certified Expert & Instructor at Noble Desktop | Web Developer, Designer, InDesign Scriptor
TOPICS
Scripting

Views

20.9K

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

Community Expert , Dec 17, 2011 Dec 17, 2011

Thank you all so much for your replies, and thank you Harbs for making it finally work!

Just to make sure this can serve as a resource for others in the future, below is a final (working) menu based on Harb's code. I also added 2 submenu items just to be complete.

Thanks again everyone. I'm so glad you could help get this working!

Dan

#targetengine "HarbsTestMenu"

menuInstaller();

function menuInstaller() {

    // SET THE FILES THAT ARE TRIGGERED BY MENU ITEMS

    menuItem1Handler = function( /*onInvo

...

Votes

Translate

Translate
Guide ,
Dec 18, 2011 Dec 18, 2011

Copy link to clipboard

Copied

Dan Rodney wrote:

Marc. Is it possible to insert menu dividers in your example? And if so, how?

You mean menuSeparators, right?

I slightly expanded the code to support the following syntax:

FEATURES = [

   { caption: "My Menu Item 1", fileName: 'File-One.jsx', subName: "" },

   { separator: true, subName: "" },

   { caption: "My Menu Item 2", fileName: 'File-Two.jsx', subName: "My Sub Menu" },

   { separator: true, subName: "My Sub Menu" },

   { caption: "My Menu Item 3", fileName: 'File-Three.jsx', subName: "My Sub Menu" }

]

Also, I removed the #targetengine stuf and the HOST argument. As John said, this is uselessly complicated for such a project. Note that this startup script does not need to run in a persistent engine.

Here is a possible implementation:

// MenuLoader

// (#targetengine is not required)

(function()

// -------------------------------------

// Install and/or update the menu/submenu and connect

// the corresponding menu actions if script files are available

{

    // Settings and constants

    // ---

    var MENU_NAME = "My Test Menu",

        FEATURES = [

            { caption: "My Menu Item 1", fileName: "File-One.jsx", subName: "" },

            { separator: true, subName: "" },

            { caption: "My Menu Item 2", fileName: "File-Two.jsx", subName: "My Sub Menu" },

            { separator: true, subName: "My Sub Menu" },

            { caption: "My Menu Item 3", fileName: "File-Three.jsx", subName: "My Sub Menu" }

            ],

        LO_END = LocationOptions.atEnd,

        INDESIGN_ROOT_MENU = app.menus.item( '$ID/Main' ),

        FEATURE_LOCATION_PATH = (function()

            {

            var f;

            try{ f=app.activeScript; }

            catch(_){ f=File(_.fileName); }

            return f.parent.parent + '/';

            })();

    // (Re)set the actions

    // Note: checks also whether script files are available

    // ---

    var    t, f,

        i = FEATURES.length;

    while( i-- )

        {

        t = FEATURES;

        if( t.separator ) continue;

        if( (f=File(FEATURE_LOCATION_PATH + t.fileName)).exists )

            {

            // The script file exists => create the corresponding action

            // and directly attach the event listener to the file

            // (no need to use app.doScript(...) here)

            // ---

            (t.action = app.scriptMenuActions.add( t.caption )).

                addEventListener('onInvoke', f);

            }

        else

            {

            // The script file does not exist => remove that feature

            // ---

            FEATURES.splice(i,1);

            }

        }

    // ---

    // Create/reset the custom menu container *if necessary*

    // Note:  menus/submenus are application-persistent

    // ---

    var    mnu = INDESIGN_ROOT_MENU.submenus.itemByName( MENU_NAME );

    if( !mnu.isValid )

        {

        // Our custom menu hasn't been created yet

        // ---

        if( !FEATURES.length ) return;

        mnu = INDESIGN_ROOT_MENU.submenus.add(

            MENU_NAME,

            LocationOptions.after,

            INDESIGN_ROOT_MENU.submenus.item( '$ID/&Window' )

            );

        }

    else

        {

        // Our custom menu already exists, but we must clear

        // any sub element in order to rebuild a fresh structure

        // ---

        mnu.menuElements.everyItem().remove();

        // If FEATURES is empty, remove the menu itself

        // ---

        if( !FEATURES.length ){ mnu.remove(); return; }

        }

    // ---

    // Now, let's fill mnu with respect to FEATURES' order

    // (Possible submenus are specified in .subName and created on the fly)

    // ---

    var s,

        n = FEATURES.length,

        subs = {},

        sub = null;

    for( i=0 ; i < n ; ++i )

        {

        t = FEATURES;

        // Target the desired submenu

        // ---

        sub = (s=t.subName) ?

            ( subs || (subs=mnu.submenus.add( s, LO_END )) ) :

            mnu;

        // Connect the related action OR create a separator

        // ---

        if( t.separator )

            sub.menuSeparators.add( LO_END);

        else

            sub.menuItems.add( t.action, LO_END );

        }

})();

menuLoader.png

@+

Marc

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 ,
Dec 18, 2011 Dec 18, 2011

Copy link to clipboard

Copied

Wow, this has been quite a discussion! First let me thank everyone. This has all helped tremendously. We now have two ways to make working menus. I don't think I've every such a complete roundup of menu creation code anywhere else on the web. This is such a cool ability and so little is said about it. I must say that the scripting documenation often doesn't help "me" to be able to program new features from scratch. There can be little syntax issues or things that need to be done that the documentation doesn't convey to me, and this forum is so important because there are so few InDesign scriptors out there.

Thanks Marc for posting your finished example with menuSeparators. It's certainly easy to edit the parts of the menu in your script.

Please keep in mind that the original code was not even my style of writing. It was based on the blog post of Marijan Tompa (tomaxxi). I had to start with that to learn menu creation because it was the most complete menu setup code I could find, and reading the documentation wasn't helping me with submenus.

John, as for the ==null tests, they work in CS3 and later. If I switch to isValid that only works in CS5 (from what I understand). What cross-version compatible code do you think is better?


— Adobe Certified Expert & Instructor at Noble Desktop | Web Developer, Designer, InDesign Scriptor

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
Guide ,
Dec 18, 2011 Dec 18, 2011

Copy link to clipboard

Copied

About isValid missing in CS3, you could try sth like this:

// Declare isValid() at the beginning of the current scope/script

// ---

var isValid = ( parseFloat(app.version) >= 6 ) ?

    function(o)

    {

        return o.isValid;

    } :

    function(o)

    {

        var r = false;

        try    {

            ('id' in o && o.id) ||

            ('index' in o && o.index);

            r = true;

            }

        catch(_){}

        return r;

    };

Then replace myObj.isValid by isValid(myObj) in the entire code.

@+

Marc

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 ,
Dec 18, 2011 Dec 18, 2011

Copy link to clipboard

Copied

null works perfectly well for menu actions. I'm not sure why we're making a deal of this...

FWIW, here's the IsValid function that I use:

IsValid = function (obj){

    try{

        if(!obj){return false}

        if(kAppVersion>=6){

            return obj.isValid;

        }

        var test = obj.parent;

        return true;

    }

    catch(err){return false;}

}

kAppVersion is a constant I have defined like so:

kAppVersion = parseFloat(app.version);

(Every valid object in InDesign has a parent.)

Harbs


( P.S. The test variable name is extraneous, but it makes it obvious what it's doing...)

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
Guide ,
Dec 18, 2011 Dec 18, 2011

Copy link to clipboard

Copied

Harbs. wrote:

null works perfectly well for menu actions. I'm not sure why we're making a deal of this...

Because—I totally agree with John— using ==null is both a bad practice and semantically irrelevant.

Marc

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 ,
Dec 18, 2011 Dec 18, 2011

Copy link to clipboard

Copied

Marc Autret wrote:

Because—I totally agree with John— using ==null is both a bad practice and semantically irrelevant.

Tell that to Jonathan Brown who designed it in the first place!

(See the code I pasted above.)

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 ,
Dec 18, 2011 Dec 18, 2011

Copy link to clipboard

Copied

John, as for the ==null tests, they work in CS3 and later. If I switch to isValid that only works in CS5 (from what I understand). What cross-version compatible code do you think is better?

Oh, I wasn't referring to .isValid! I didn't mean that at all. I meant what I said in post #1, after I mentioned it. Replace if (var==null) with if (!var). === is almost always better than ==, because truthiness of == causes confusion and problems. But in ifs, you might as well use the implicit truthiness and not test explicitly, and write for clarity. (Someone is going to say this argument is defective ).

By the way, there's some sample Adobe script that creates menus. Maybe it's hidden in the Bridge SDK or something. I can't remember, something to do with some font. I haven't looked at the code though, so who knows. I suspect it is rather different than any of the examples so far...

Marc's absolutely right, your code should not be using global variables! What a nightmare those are. Remember anything in a function without an explicit 'var' on it somewhere is global. "Oops." That's what happens when you design a language in 10 days (Javascript).

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 ,
Dec 18, 2011 Dec 18, 2011

Copy link to clipboard

Copied

John Hawkinson wrote:

By the way, there's some sample Adobe script that creates menus.

Is this what you're talking about? It's distributed in the InDesign SDK...

XHTMLExportMenuItem.install = function()

{   

    if(app.name == "Adobe InDesign") {

        // set up our script preferences

        var currDOMVersion = app.scriptPreferences.version;

        if (currDOMVersion != XHTMLExportMenuItem.requiredDOMVersion)

            app.scriptPreferences.version = XHTMLExportMenuItem.requiredDOMVersion;

        // determine and store the path from were we load our scripts from

        XHTMLExportMenuItem.storeScriptsFolderPath();

        // load XHTMLExporter for the strings

        var xhtmlExporterScript = XHTMLExportMenuItem.loadScript('XHTMLExport.jsxbin');

        if ( !xhtmlExporterScript.exists )

        {

            xhtmlExporterScript = XHTMLExportMenuItem.loadScript('XHTMLExport.jsx');

        }

        assert( xhtmlExporterScript.exists, "XHTMLExport.jsx* missing; load failed" ) ;

        if ( xhtmlExporterScript.exists )

        {

            var cacheCurrent = Folder.current ;

            try

            {

                Folder.current = XHTMLExportMenuItem.scriptsFolder ;

                app.doScript( xhtmlExporterScript ) ;

            }

            finally

            {

                Folder.current = cacheCurrent ;

            }

            if ($.locale != 'en_US')

            {

                // try to load localized strings

                var localizationScript = XHTMLExportMenuItem.loadScript('Resources/XHTMLStrings-' + $.locale + '.jsxbin');

                if ( !localizationScript.exists )

                {

                    localizationScript = XHTMLExportMenuItem.loadScript('Resources/XHTMLStrings-' + $.locale + '.jsx');

                }

                assert( localizationScript.exists, 'Resources/XHTMLStrings-' + $.locale + '.jsx* missing; load failed' ) ;

                if ( localizationScript.exists )

                {

                    var cacheCurrent = Folder.current ;

                    try

                    {

                        Folder.current = Folder( XHTMLExportMenuItem.scriptsFolder + '/Resources' ) ;

                        app.doScript( localizationScript ) ;

                    }

                    finally

                    {

                        Folder.current = cacheCurrent ;

                    }

                }

            }

            // menu action for the File:Export for menu

            var actionname = localize(xhtmlExportStrings.FORDREAMWEAVERACTIONNAME);

            var action = app.scriptMenuActions.item(actionname);

            if(action == null) {

                // first launch:

                // we need to create the menu action

                var action = app.scriptMenuActions.add(actionname);

                action.area = app.translateKeyString('$ID/KBSCE File menu: ExportForSubMenu');

                action.checked = false;

                action.enabled = true;

            }

            // install event listeners for our action

            action.addEventListener("onInvoke", XHTMLExportMenuItem.exportSelectedItems);   

            action.addEventListener("beforeDisplay", XHTMLExportMenuItem.enableDisable);

            action.addEventListener("afterInvoke", XHTMLExportMenuItem.cleanup);

            // install the menu item

            var exportForMenu = app.menus.item(app.translateKeyString('$ID/Main')).submenus.item(app.translateKeyString('$ID/&File')).submenus.item(app.translateKeyString('$ID/ExportForSubMenu')) ;

            exportForMenu.menuItems.add(action);

            // store the action in a class variable

            XHTMLExportMenuItem.action = action;

        }

        if(currDOMVersion != XHTMLExportMenuItem.requiredDOMVersion)

            app.scriptPreferences.version = currDOMVersion;

    }

}

Harbs

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 ,
Dec 18, 2011 Dec 18, 2011

Copy link to clipboard

Copied

Is this what you're talking about? It's distributed in the InDesign SDK...

*cry*

No. Normally I'd say you should include the filename when you make such references, but in this case... please don't.


There's some script that adds a toplevel menu for a Font. I guess I am just not excited enough (afraid?) to go looking for it. Especially after that snippet you posted.

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 ,
Dec 18, 2011 Dec 18, 2011

Copy link to clipboard

Copied

(I love making grown men cry...)

The snippet I posted above was written by Jonathan Brown. It's pretty obvious where it came from (HTML export).

The font snippet is in the InDesign Scripting Guide pdf.

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
Participant ,
Dec 19, 2012 Dec 19, 2012

Copy link to clipboard

Copied

Hi,

 

   Why the customized menuItems cannot displaying in "Edit->Menus...->category - > application menu"???

     But it displaying customized submenu...

Thanks.

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 ,
Dec 18, 2011 Dec 18, 2011

Copy link to clipboard

Copied

John Hawkinson wrote:

Replace if (var==null) with if (!var). === is almost always better than ==, because truthiness of == causes confusion and problems. But in ifs, you might as well use the implicit truthiness and not test explicitly, and write for clarity. (Someone is going to say this argument is defective ).

In my opinion, discussions about == vs. === vs implicit resolutions is kind of silly. I have no issue using ==. Just make sure you understand what it means.

Personally, I only use === when I really need it. That way it's clear what I'm testing for... When I'm testing for bull or boolean values, I usually skip the "==" altogether.

I don't take everything Crawford says as if it's the bible. They're only his opinions after all...

Harbs

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 ,
Dec 18, 2011 Dec 18, 2011

Copy link to clipboard

Copied

In my opinion, discussions about == vs. === vs implicit resolutions is kind of silly. I have no issue using ==. Just make sure you understand what it means.

Personally, I only use === when I really need it. That way it's clear what I'm testing for... When I'm testing for bull or boolean values, I usually skip the "==" altogether.

The problem is that it is often fairly subtle "when you really need it," and you don't notice until you've been bitten by it.

Everyone is pretty much always better off with ===.

I don't take everything Crawford says as if it's the bible. They're only his opinions after all...

Crockford.

And yes, his opinions are actually increasingly problematic. I can't even use JSLint anymore, he's added so many inappropriate checks that really boil down to style. The jslint_com yahoo group is kind of unpleasant. Oh well.

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 ,
Dec 18, 2011 Dec 18, 2011

Copy link to clipboard

Copied

John Hawkinson wrote:

The problem is that it is often fairly subtle "when you really need it," and you don't notice until you've been bitten by it.

Everyone is pretty much always better off with ===.

I actually came across a situation where === was problematic, but I don't remember the details. There's no replacement for properly learning a language you use. (Whether it's a spoken language or computer one...)

John Hawkinson wrote:

Crockford.

Oops. Never nice to bollix up someone's name...

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 ,
Dec 18, 2011 Dec 18, 2011

Copy link to clipboard

Copied

I actually came across a situation where === was problematic, but I don't remember the details.

I think a common case is confusion between null and undefined. For instance:

var v;

...

if (v==0) { v="now initialized!"; }

will "work" and initialize v, because v is undefined, and "undefined==0" returns true. So if you just changed it to

var v;

...

if (v===0) { v="now initialized"; }

then v would never get initialized. Of course, this is bad code because you should have initialized v in the var line anyhow, or you should have tested it against "undefined" and not "0" or "null," or halfadozen other reasons.

Anyhow, I feel like your exception proves the rule. Use '===' always, unless you learn the language well enough to require truthiness promotion, because if you don't, you are likely to make an assumption about whether something is false versus null versus undefined, and that assumption will come back and hurt you later.

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 ,
Dec 18, 2011 Dec 18, 2011

Copy link to clipboard

Copied

No. That wasn't what I was talking about. I think it had something to do with String objects and String literals. But, I don't remember...

Harbs

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 ,
Dec 18, 2011 Dec 18, 2011

Copy link to clipboard

Copied

John Hawkinson wrote:

Anyhow, I feel like your exception proves the rule. Use '===' always, unless you learn the language well enough to require truthiness promotion, because if you don't, you are likely to make an assumption about whether something is false versus null versus undefined, and that assumption will come back and hurt you later.

This is a bit like philosophy. You can argue both sides until you're blue in the face. Just about anyone coming from a C background would probably disagree. There's quite a lot of people who look at 0 and false as synonymous...

Whatever; I have bigger fish to fry...

Harbs

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
New Here ,
Dec 23, 2011 Dec 23, 2011

Copy link to clipboard

Copied

Hi Marc,

i tried your MenuLoader and it works like a charm.

One question is still open: Is there a chance to create KeyboardShortcuts for a custom menu that will work even after a ShutDown & Restart of InDesign?

Cheers

Juergen

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 ,
Dec 23, 2011 Dec 23, 2011

Copy link to clipboard

Copied

Juergen:

One question is still open: Is there a chance to create KeyboardShortcuts for a custom menu that will work even after a ShutDown & Restart of InDesign?

They should just work. Did you try them?

Please note that you cannot create KBSCs in the scripting interface, you must do so by hand in the UI. (well, I suppose you could edit InDesign's xml file that stores this information, but that wouldn't be very...clean.)

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
New Here ,
Dec 23, 2011 Dec 23, 2011

Copy link to clipboard

Copied

Hi John,

i created the KBSCs via the Indesign UI.

They are shown in the menu and work.

But when i restart Indesign they are gone.

Cheers

Juergen

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
Guide ,
Dec 23, 2011 Dec 23, 2011

Copy link to clipboard

Copied

JuMayr wrote:

Hi Marc,

i tried your MenuLoader and it works like a charm.

One question is still open: Is there a chance to create KeyboardShortcuts for a custom menu that will work even after a ShutDown & Restart of InDesign?

Cheers

Juergen

Hi Juergen,

Thanks for your feedback. I haven't seriously studied keyboard shortcuts issues but I know this is a very complicated topic to scripters. What we can guess is that temporarily removing/refreshing menu actions—as my script does—does not preserve the existing KB shortcuts, because InDesign dynamically clears them as soon as the 'link' is broken between a shortcut and a custom action—I suppose. So we need to restore removed shortcuts, but AFAIK the scripting DOM does not provide any interface do do that. I don't even know if rewriting on the fly the 'indk' file could actually work. Maybe other people here have already investigated this point.

@+

Marc

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 ,
Dec 24, 2011 Dec 24, 2011

Copy link to clipboard

Copied

Yes. Menu Actions are saved cross-session. They are cleared out on shutdown only if there's no associated menu item.

If you remove it and create a new one, keyboard shortcuts are lost.

I'm pretty sure you should be able to add and remove menu items without issues. The keyboard shortcuts are associated with the actions.

Harbs

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
Enthusiast ,
Aug 31, 2017 Aug 31, 2017

Copy link to clipboard

Copied

Hey there,

the script still works like a charm, but is it possible to hide submenus (including possible separators) when the script file within that submenu doesn't exist?

Thanks

Jens

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 ,
Oct 12, 2016 Oct 12, 2016

Copy link to clipboard

Copied

how to add menus and submenus in looping condition and how to invoke the process in looping. how to separate the menu with submenu in looping..

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 ,
Oct 20, 2016 Oct 20, 2016

Copy link to clipboard

Copied

is there any update on my request.....

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