An example of UIAutomation
Not logged in
This forum is sponsored by Mistachkin Systems.
Eagle: Secure Software Automation
Thank you very much.
I didn't notice that I was using .NET Framework 2.0 version of Eagle and Garuda.
When I replaced both with Beta 50 targeting .NET Framework 4.0, class loading got successful.

```
Eagle 1.0.8192.54321 trusted genuine official stable beta {Fire Dragon Series, Beta 50} NetFx40 Release {Tcl 8.4.21} {2022.05.06T21:42:00.000 +0900} 48b99035ca39c1100f84abd801d0309f6ce25106 {2022-05-26 21:44:39 UTC} {Microsoft.NET 4.0.30319.42000 [4.8.4515.0 built by: NET48REL1LAST_C] 528372} {Windows NT} intel  

Garuda 1.0 48b99035ca39c1100f84abd801d0309f6ce25106 {2022-05-26 21:44:39 UTC}  
```

One issue left might be specific to the GUI which I was going to automate. So, I'm not sure if I can ask of your help.
According to Inspect.exe, this button supports InvokePattern. But when I try GetCurrentPattern, it throws System.InvalidOperationException: Unsupported Pattern.
Do you think it has something to do with the usage of eagle script?


```
How found:	Selected from tree...
Name:	"Open the Sample Window"
ControlType:	UIA_ButtonControlTypeId (0xC350)
LocalizedControlType:	"button"
:
IsInvokePatternAvailable:	true
```

Test script.


```
package require Garuda

puts [eagle version]
puts [garuda packageid]

eagle {
	object load UIAutomationClient
	object load UIAutomationTypes
	object load UIAutomationProvider
}

eagle {
	set assembly [object load -alias UIAutomationClientsideProviders]
	object import System.Windows.Automation
	object invoke ClientSettings RegisterClientSideProviderAssembly [$assembly GetName]
}

eagle {
	set prop(aid) [object invoke AutomationElement AutomationIdProperty]
	set prop(name) [object invoke AutomationElement NameProperty]
	set patt(invoke) [object invoke InvokePattern Pattern]
}

eagle {
	set elem(root) [object invoke -alias AutomationElement RootElement]
}

eagle {
	set cond(sample) [object create PropertyCondition $prop(name) "Open the Sample Window"]
	set elem(sample) [$elem(root) -alias FindFirst Descendants $cond(sample)]
	[$elem(sample) -alias GetCurrentPattern $patt(invoke)] Invoke
}
```

The line of error and the stack trace.

```
eagle {$elem(sample) -alias GetCurrentPattern $patt(invoke)}
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Unsupported Pattern.

   at System.Windows.Automation.AutomationElement.GetCurrentPattern(AutomationPattern pattern)

   --- End of inner exception stack trace ---

   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)

   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)

   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

   at Eagle._Commands.Object.Execute(Interpreter interpreter, IClientData clientData, ArgumentList arguments, Result& result)

```