0 Replies Latest reply on Jul 31, 2015 3:09 PM by RobertKyle

    Show/hide tracked changes

    RobertKyle Level 2

      The goal is to make sure that View Changes is always on. AFAIK, there's no direct access via javascript, nothing like app.viewPreferences.showNotes = true. I would be very happy to be wrong about that.


      So my next move was to script the UI, but the results were inconsistent. So I worked up this snippet to see what's going on:


      if (app.menuActions.item("Show Changes").isValid) {

           $.writeln("invoking menuAction");

          app.menuActions.item("Show Changes").invoke();


      app.menuActions.itemByID(42254).name; // 42254 could also be named "Hide Changes"


      Starting with a View menu where "Show Changes" is the last command, the script invokes the menuAction as you would expect. But it also returns "Show Changes" as the name of the menuAction. If you look back at the View menu, you'll see that that is not the case: the script has changed it to "Hide Changes" as you would expect. Run the script again, and you'll see that invoke() has not occurred and the name of the menuAction returns correctly as "Hide Changes".


      In other words, if you simply look at the View menu before running the script, it all makes sense. But if you use the View menu to switch between Show and Hide changes, it does not. And the whole purpose of the script is to make sure that Show Changes is on, even if the user has manually selected Hide. (The script would run as an event listener whenever a document is opened).


      What I think is happening is that Adobe is not rebuilding the menu immediately after the setting is changed in the UI. Maybe not until the user displays the menu again.


      If that's the case, I'm stuck unless I can come with a way to force the menu to update at the beginning of the script.