Copy link to clipboard
Copied
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");
Copy link to clipboard
Copied
JHowe,
I don't know about this for sure, but I've always believed that there is no undo for an FDK or ES action, unless you track it and undo it yourself. There used to be hardly any undo for FM at all, so I'd be real surprised if it was extended to the automation interfaces. Of course, I'd be interested to find out otherwise.
Russ
Copy link to clipboard
Copied
Very belated, but for the benefit of those like myself who are searching the archives, this worked for me:
// enable FDK undo recording; this is false by default, maybe for performance app.UndoFDKRecording = true; // get document for editing; subsequent error checking omitted var doc = app.ActiveDoc; // start of FDK calls for grouping together as a single undoable action; // the given description appears as Edit > Undo My Description doc.UndoStartCheckPoint("My Description"); // do stuff to the document that you might want to undo // end of FDK calls for grouping together as a single undoable action doc.UndoEndCheckPoint();
Copy link to clipboard
Copied
There was another discussion on undos here: Re: Re: ES for FM10: Adding text at insertion point
Copy link to clipboard
Copied
Thanks! That discussion mentions undo a lot. I wish I'd found it earlier.
I guess I've just learnt to use the Search Communities dialog, which would have found it:
https://forums.adobe.com/search.jspa?q=undo&place=%2Fplaces%2F1414099
rather than the tempting looking Type to filter by text dialog, which doesn't find it: