0 Replies Latest reply on Jul 16, 2013 3:52 AM by s_ashok

    Creating menu

    s_ashok Level 1

      error.jpg

       

       

      The script was running at the first time. when i close and reopen the application its error message i have attached screen shot for you reference.

       

       

       

       

       

      #targetengine "HarbsTestMenu"

       

      menuInstaller();

       

      function menuInstaller() {

          // SET THE FILES THAT ARE TRIGGERED BY MENU ITEMS

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

          menuItem1Handler = function( /*onInvoke*/ ){

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

          };

          menuItem2Handler = function( /*onInvoke*/ ){

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

          };

      menuItem3Handler = function( /*onInvoke*/ ){

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

          };

      menuItem4Handler = function( /*onInvoke*/ ){

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

          };

          subMenuItem1Handler = function( /*onInvoke*/ ){

              app.doScript( File(myFolder + 'Ballart Tiping.jsx') );

          }; 

      sub1TMenuItem1Handler = function( /*onInvoke*/ ){

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

         }; 

       

         subMenuItem2Handler = function( /*onInvoke*/ ){

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

        }; 

       

          // SET GENERAL VARIABLES

          try {

              myFolder = app.activeScript;

          }

          catch(e) {

              myFolder = File(e.fileName);  // we are running from the ESTK

          }

          myFolder = myFolder.parent.parent  + '/Scripts Panel/' ;  //this file is in the "startup scripts" subfolder

       

          var menuItem1T = "Rename_Links",

             menuItem2T = "Conver RGB image to CMYK",

             menuItem3T = "Conver ALL image to Gray",

             menuItem4T = "Add & Remove Unwated Swatches/Convert RGB,Spot Colors to CMYK",

             subMenuItem1T = "Ballart Footy Tipping",

             sub1TMenuItem1T = "To Come",

       

            subMenuItem2T = "AddPoints",

             menuT = "2adpro_Automation",

             subT = "Ballart",

             sub1T = "Wagga wagga",

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

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

       

          // CREATE MENU ITEMS

          subMenu1 = app.scriptMenuActions.item(menuItem1T);

          if( subMenu1 == null ) {

              subMenu1 = app.scriptMenuActions.add(menuItem1T);

          }

          subMenu1.eventListeners.add("onInvoke", menuItem1Handler);

       

          subMenu2 = app.scriptMenuActions.item(menuItem2T);

          if( subMenu2 == null ) {

              subMenu2 = app.scriptMenuActions.add(menuItem2T);

          }

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

       

       

          subMenu3 = app.scriptMenuActions.item(menuItem3T);

          if( subMenu3 == null ) {

              subMenu3 = app.scriptMenuActions.add(menuItem3T);

          }

          subMenu3.eventListeners.add("onInvoke", menuItem3Handler);

       

      subMenu4 = app.scriptMenuActions.item(menuItem4T);

          if( subMenu4 == null ) {

              subMenu4 = app.scriptMenuActions.add(menuItem4T);

          }

          subMenu4.eventListeners.add("onInvoke", menuItem4Handler);

        

       

          subSubMenu1 = app.scriptMenuActions.item(subMenuItem1T);

          if( subSubMenu1 == null ) {

              subSubMenu1 = app.scriptMenuActions.add(subMenuItem1T);

          }

          subSubMenu1.eventListeners.add("onInvoke", subMenuItem1Handler);

       

          subSubMenu2 = app.scriptMenuActions.item(subMenuItem2T);

          if( subSubMenu2 == null ) {

              subSubMenu2 = app.scriptMenuActions.add(subMenuItem2T);

          }

          subSubMenu2.eventListeners.add("onInvoke", subMenuItem2Handler);

       

         sub1TSubMenu1 = app.scriptMenuActions.item(sub1TMenuItem1T);

          if( sub1TSubMenu1 == null ) {

              sub1TSubMenu1 = app.scriptMenuActions.add(sub1TMenuItem1T);

          }

          sub1TSubMenu1.eventListeners.add("onInvoke", sub1TMenuItem1Handler);

       

       

          mnu = subs.item(menuT);

          if( mnu == null ) {

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

          }

       

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

          mnuSubMenu = subsSubs.item( subT );

          if( mnuSubMenu == null ) {

              mnuSubMenu = subsSubs.add( subT);

      }

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

          mnuSub1TMenu = subsSubs.item( sub1T );

          if( mnuSub1TMenu == null ) {

              mnuSub1TMenu = subsSubs.add( sub1T);           

          }

          mnu.menuItems.add(subMenu1,LocationOptions.BEFORE,mnuSubMenu);

          mnu.menuItems.add(subMenu2,LocationOptions.BEFORE,mnuSubMenu);

          mnu.menuItems.add(subMenu3,LocationOptions.BEFORE,mnuSubMenu);

          mnu.menuItems.add(subMenu4,LocationOptions.BEFORE,mnuSubMenu);

          mnu.menuSeparators.add(LocationOptions.BEFORE,mnuSubMenu);

          mnuSubMenu.menuItems.add(subSubMenu1,LocationOptions.AFTER,mnuSubMenu);

          mnuSub1TMenu.menuItems.add(sub1TSubMenu1,LocationOptions.AFTER,mnuSub1TMenu);

          mnuSubMenu.menuItems.add(subSubMenu2,LocationOptions.AFTER,mnuSubMenu);

      };