4 Replies Latest reply on May 26, 2015 8:30 AM by Mike-Hardy

    Undo support around extendscript command

    JHowe99

      This probably should be obvious, but how can "undo" be supported for a custom command(in Framemaker 10?  I found app.beginUndoGroup() for another product but frame gives an unknown method call for this.

       

      The following will delete with Ctrl-Q, but "undo" remains greyed out.  Thanks in advance.

       

      function demoDelete() {

          var doc = app.ActiveDoc;

          if (!doc) {

              alert("No active document");

              return;

          }

          var range = doc.TextSelection;

          if (range.beg.offset == range.end.offset) {

              alert("Need to select some text");

              return;

          }

          doc.DeleteText(range);

      }

      function Command(cmd) {

          app.beginUndoGroup("demoCsr Command");

          switch (cmd) {

          case 1111: {

              demoDelete();

          }

          app.endUndoGroup();

      }

      var cmd = DefineCommand(1111, "demoCsrXrefInsert", "demoCsrXrefInsert", "^q");