I'm struggling to find a way to work with Global Edit from within a script and wondering if anyone has done this?
I can't find the correct executeMenuCommand() syntax to start/stop the edit, so the only way I've found to trigger it from javascript is by shimming it through an action, this starts the global edit session ok.
I can then paste a path into the global edit session via script, but as soon as I try to move that path to the correct location the global edit session ends without updating all the other instances. So the end result is that the pasted path is in the correct location, but only for the initially selected shape rather than for every instance of the shape found by the global edit tool.
So the current code looks sort of like this:
//Start Global edit action
var set = "Default";
var actionName = "StartGlobalEdit"
app.doScript(actionName, set)
//Paste the shape
app.paste()
//Move the pasted shape - this breaks the global edit :-(
var item = newDoc.selection[0];
item.left = 123
item.top = 456
//Exit Global Edit
actionName = "StopGlobalEdit"
app.doScript(actionName, set)
redraw()
I'm sure I'm missing something obvious!