trueSpace scripts create an undo step for each command in the script that changes the graph. So a single script can have many undo steps generated. The trueSpace script buffer will run a collection of script commands in the form of a string and generate only 1 undo.
Function set variables can be used to pass complex data structures to the buffer.
var cmd = '' // note that if System.ThisOwner() is included in the buffer tS will crash var thisowner = System.ThisOwner() cmd += var owner = "' + thisowner + '";' cmd += 'System.Trace(owner)' RsApp.RunScriptBuffer(cmd);