1 Reply Latest reply on Sep 23, 2008 6:45 PM by (Brett_Elliott)

    JS Accessing the Paragraph Styles Panel Menu?? PLEASE HELP!

      I haven't heard anything yet about this topic, can anyone help me?

      Hi all,

      I'm hoping you can help me with is, I'm about to tear my hair out! I'm using JavaScript in InDesign CS3 (PC). I have three heading scripts that I wrote that go through a series of actions when clicked, and I need to be be attached to the appropriate paragraph styles. This is so the user will receive a certain look and feel when they click the style, but they won't know a script ran at all, they'll think it's just another paragraph style.

      I ran the menu id script from the InDesign Scripting Guide, and it says that the root ID should be "Paragraph Style Panel Menu", however, that is not working. HELP! How can I get InDesign to reference the existing Paragraph Style Panel Menu?

      THANK YOU! Code below:

      myDoc = app.activeDocument;

      var setpath = "~/Application Data/Adobe/InDesign/Version 5.0/Scripts/Scripts Panel/";

      var myScript1 = new File(setpath + "Heading 1.jsx");
      var myScriptAction1 = app.scriptMenuActions.add("InD - Heading 1");
      var myEventListener1 = myScriptAction1.eventListeners.add("onInvoke", myScript1, false);

      var myScript2 = new File(setpath + "Heading 2.jsx");
      var myScriptAction2 = app.scriptMenuActions.add("InD - Heading 2");
      var myEventListener2 = myScriptAction2.eventListeners.add("onInvoke", myScript2, false);

      var myScript3 = new File(setpath + "Heading 3.jsx");
      var myScriptAction3 = app.scriptMenuActions.add("InD - Heading 3");
      var myEventListener3 = myScriptAction3.eventListeners.add("onInvoke", myScript3, false);

      try{
      var myScriptMenu = app.menus.item("$ID/Paragraph Style Panel Menu");
      myScriptMenu.title;
      }
      catch (myError){
      var myScriptMenu = app.menus.add("$ID/Paragraph Style Panel Menu");
      }

      var myScriptMenuItem1 = myScriptMenu.menuItems.add(myScriptAction1);
      var myScriptMenuItem2 = myScriptMenu.menuItems.add(myScriptAction2);
      var myScriptMenuItem3 = myScriptMenu.menuItems.add(myScriptAction3);