0 Replies Latest reply on Jul 16, 2014 5:09 AM by Manan Joshi

    MenuAction Object not valid if preferences are trashed

    Manan Joshi Level 4

      I am trying the following code

      var myMenuAction = app.menuActions.item("$ID/Untag Text");

      alert(myMenuAction.isValid)

       

      This gives an alert of "false" if its executed after the preferences are trashed, however if i select some tagged text and right click so that the context sensitive menu containing the "Untag Text" is visible then the above code snippet gives "true" as an alert and remains so that way unless the preferences are again trashed. I am not sure why this is happening and how is this implemented in InDesign, somehow clicking once to show the menu creates that object of MenuAction and then it's accessible. Does preferences somehow preserve this information, are these objects serialised in preferences?

       

      It will be very helpful if the august members of this forum could shed some light on this query and how best to make sure that the above line of code works independent of the preferences state.

       

      Thanks,

      MJ