I moved your question to the scripting forum, but I have to say that I would not want to use a script that cannot be undone.
AUTO_UNDO would be the closest thing to what you are looking for. It will "merge" all the stuff the script has done with the previous undo action.
Another way would be to clear the undo stack by doing a "save as" (doc.save(doc.fullName))
I definitely would like scripts to be able to be undo-ed and re-doed.
i discovered that somehow if script contains insertLabel(), it will not be a clean undo of the entire script prior to that in a single ctrl+Z action, i also got "Set scripting tag" in the undo listing..
Thanks for the response.
in the case on insertLablel, AUTO_UNDO is perfect