/// Boilerplate to determine which document to modify ...
function FindDocument(ScriptName)
{
if(Document)
return Document;
else
{
if(Application.documents.length == 1)
return Application.documents[0];
else if(Application.documents.length == 0)
Application.ui.ErrorMessage("You must have an open document to run this script!", ScriptName + ":");
else
Application.ui.ErrorMessage("Not sure which document to use ... try using the desired document's Document Window > Tools > Play Script.", ScriptName + ":");
}
return null;
}
document = FindDocument("dag_test.javascript");
if(document)
{
// Start recording changes for undo-purposes ...
document.StartChangeSet();
sphere1 = document.CreateObject("Sphere");
sphere2 = document.CreateObject("Sphere");
// Link the first sphere's radius property to the second's ...