protected override void ProcessRecord() { AutomationElement root = this.Root ?? AutomationElement.RootElement; TreeScope scope = this.Recurse.IsPresent ? TreeScope.Descendants : TreeScope.Children; Condition[] conditions = this.Condition ?? TrueCondition; foreach (var condition in conditions) { var results = root.FindAll(scope, condition); var wrappedResults = PSObjectFactory.WrapElements(results.OfType <AutomationElement>()); this.WriteObject(wrappedResults, true); } }
protected override void ProcessRecord() { this.WriteObject(PSObjectFactory.WrapElement(AutomationElement.RootElement)); }