2 Replies Latest reply on Oct 5, 2009 4:49 AM by ChristianPoulin

    Script and Menu


      It seems that the feature in Preferences > General > Script, when turning on offerts the possibility to connect a script to a item of menuy


      Is that true? if Yes, how to do that, even with a "Hello Word" example

        • 1. Re: Script and Menu
          Thomas B. Nielsen Level 3

          You dont know when you would want to turn off scripting, but here's an example of how to add a menu item


          You should have a look at the example scripts:

          //An InDesign CS4 JavaScript
          //Adds a menu at the end of the main menu bar.
          #targetengine "session"
          function main(){
          function mySetup(){
          function mySnippet(){
              var mySampleScriptAction = app.scriptMenuActions.add("Display Alert");
              var myEventListener = mySampleScriptAction.eventListeners.add("onInvoke", myFunction, false);
              //If the submenu "Script Menu Action" does not already exist, create it.
              //You might have to force InDesign to redraw the menu (by switching
              //out of the application and back again) to make the menu item appear.
                  var mySampleScriptMenu = app.menus.item("$ID/Main").submenus.item("Script Menu Action");
              catch (myError){
                  var mySampleScriptMenu = app.menus.item("$ID/Main").submenus.add("Script Menu Action");
              var mySampleScriptMenuItem = mySampleScriptMenu.menuItems.add(mySampleScriptAction);
          function myTeardown(){
          function myFunction(){
              alert("This menu item was added by a script.");

          • 2. Re: Script and Menu
            ChristianPoulin Level 1

            Thanks - With this anwser I have find others samples in AppleScript

            In the Preferences Panne, If turn on, the items of the personnal menu are avalaibales,  in gey if turn off