However after upgrading to 5.2 detecting of the selected objects does not work any longer. Even though nothing is selected “SelectedObjects” returns 1.
The macro looks something like this:
var App = System.GetInterface(“Application”);
var Model = App.ActiveModel;
var WS = App.ActiveWorkSpace;
var form, lblSeparator, txtSeparator, lblQuotations, txtQuotations;
form = System.CreateForm(‘Form’,‘Generate ChangeSet’, 250, 200);
form.ExecuteScriptName = ‘GenerateChangeSet’;
form.ExecuteMethodName = ‘GenerateLB’;
form.CloseAfterExecute = true;
… add some controls to the dialog
if (This.Count > 0) – this always returns 1
lblSelected = form.AddControl(“lblSelectedCount”, 5);
lblSelected.Caption = “Exporting " + This.Count + " objects to change set”;
lblSelected.Left = 8;
lblSelected.Top = 100;
var sel = SelectedObjects.Count;
if (sel = 0)
… generate all objects
… generate selected objects
Inside the “generated selected” objects part I have a for loop that calls SelectedObjects.GetObject(i) to retrieve the selected objects and then generates the approriate XML for them. Currently I only check for ObjectType = 2504 (tables) and ObjectType = 2503 (Relationships). The selected ObjectType is 2501 which is apparently the workspace itself.
Has this been changed in 5.2 so that the current workspace is always a “selected object”?