I think so.
No idea. there might be something here though:
It would be nice if there was a way to suspend the undo stack for a script like this.