2 Replies Latest reply on Dec 17, 2014 10:14 PM by WCBaxter

    menu item position via [AS]

    WCBaxter Level 1

      Seems simple enough, but is there an Applescript equivalent to the LocationOptions in Javascript? I'm specifically looking to add a menu item before or after another item. It appears that only associated menu action can be set. Is that correct?

       

      tell submenu "Edit" of (menu "Main")

           make menu item with properties {associated menu action: myAction}

      end tell

        • 1. Re: menu item position via [AS]
          Dirk Becker Level 4

          I found no direct way. When I use raw format, this works:

           

          property location_before : «class befo»

          property location_after : «class afte»

          property location_at_beginning : «class bgng»

          property location_at_end : «class end »

           

          tell application "Adobe InDesign CS6"

            set myAction to make script menu action

            tell submenu "Edit" of menu "Main"

            set redoMenuItem to menu item "Redo"

            make menu item with dataclass kpos»:location_after, «class kobj»:redoMenuItem} with properties {associated menu action:myAction}

            end tell

          end tell

           

          Edit: you can't use properties for the kpos / kobj tokens, my Edit menu was a bit untidy when I tried that optimization.

          • 2. Re: menu item position via [AS]
            WCBaxter Level 1

            Thank you so much for this reply, Dirk. I didn't even know you could even access properties that way. Very eye-opening. Whether or not I can utilize this kpos / kobj tokens, I definitely learned a lot and have some reading to do. Thanks!