actually it gets the active window. well at least on my side (i know, i know ;) But since you say it should not work I am wondering whether this is a feature or not. Please create a standard c# script component and replace its content with the code below. While it reports apps and docs not being the same instances, the remaining feedback seems not to confirm this: using Manifold.Interop.Scripts; using Manifold.Interop; using System; using System.Collections.Generic; class Script { static void Main() { var app1 = Context.Application; var app2 = new Application(); //test if the apps objects are the same app1.MessageBox("App1 equals app2: " + app1.Equals(app2) + "; App2 equals app1: " + app2.Equals(app1)); //Active doc var doc1 = (Document)app1.ActiveDocument; var doc2 = (Document)app2.ActiveDocument; app1.MessageBox("Doc1 equals doc2: " + doc1.Equals(doc2) + "; Doc2 equals doc1: " + doc2.Equals(doc1)); //add a temp component with a test name to doc1 var drw1 = doc1.NewDrawing("TestDrw", app1.DefaultCoordinateSystem, false); //and to doc2 var drw2 = doc2.NewDrawing("TestDrw", app2.DefaultCoordinateSystem, false); //open drw1 drw1.Open(); //get active windows var aw1 = app1.ActiveWindow; var aw2 = app2.ActiveWindow; app1.MessageBox("Active window1 equals window2: " + aw1.Equals(aw2) + "; Active window2 equals window1: " + aw2.Equals(aw1)); //compset count app1.MessageBox("Compset1 count: " + doc1.ComponentSet.Count + "; Compset2 count: " + doc2.ComponentSet.Count); //get the names of components in compsets var comps1 = new List(); foreach (Component c in doc1.ComponentSet) { comps1.Add(c.Name); } var comps2 = new List(); foreach (Component c in doc2.ComponentSet) { comps2.Add(c.Name); } //compset names app1.MessageBox( "Componenets in compset1: " + string.Join(", ", comps1) + Environment.NewLine + "Componenets in compset2: " + string.Join(", ", comps2) ); app1.MessageBox("Component names seem to be the same: " + (string.Join(", ", comps1) == string.Join(", ", comps2))); } } EDIT: v 8.0.29.0
maps made easy - www.cartomatic.pl || www.cartoninjas.net |