Jump to content

Identify .NET controls by their Name


zfisherdrums
 Share

Recommended Posts

junkew,

I have read those threads before. Lots of effort and time had put in those thread that one cannot simply or quickly grab the magnitude of it.

I want to move to ui automation but it require complete recode for what i'm planning.

What boggled me is that the same .net container elements can be identify by ranorex spy but failed to return from au3info. I suppose I know why it failed since au3info will always grab the container value which is not the actual control in .net

What so special about ranorex spying?

As you notice the ID/CLASSNN/HWD: Identical yet ranorex knows to pull and return the correct value of elements inside container.

post-76668-0-30845900-1360514148_thumb.ppost-76668-0-76133900-1360514148_thumb.p

Edited by Mun
Link to comment
Share on other sites

Try to get hold of inspect.exe part of the windows sdk

"C:Program FilesMicrosoft SDKsWindowsv7.1Binx64Inspect.exe"

http://msdn.microsoft.com/en-us/library/windows/desktop/dd318521(v=vs.85).aspx

If that shows the same value I am sure with the other threads I gave you the uiAutomation can help you further to get it thru autoit

Below some sample code which will be based on the latest beta with objcreateinterface function and uiautomation

1. run the program

2. hover to the control you are interested in

3. press ctrl+m and it will show you all information retrievable with UI automation

If you have an object you should be able to get the property with the right information you are looking for

#include <WinAPI.au3>

HotKeySet("{ESC}", "Close") ; Set ESC as a hotkey to exit the script.

HotKeySet("^m", "GetElementInfo") ; Set Hotkey Ctrl+M

;~ http://www.autoitscript.com/forum/topic/128406-interface-autoitobject-iuiautomation/
;~ http://msdn.microsoft.com/en-us/library/windows/desktop/ff625914(v=vs.85).aspx

Global $oDesktop, $pDesktop      ;Desktop will be frequently the starting point
Global $oUIElement, $pUIElement  ;Used frequently to get an element

Global Const $sCLSID_CUIAutomation="{FF48DBA4-60EF-4201-AA87-54103EEF594E}"
Global Const $sIID_IUIAutomation="{30CBE57D-D9D0-452A-AB13-7AC5AC4825EE}"
Global $dtagIUIAutomation = "CompareElements hresult(ptr;ptr;long*);" & _ ;CompareElements hresult([in] IUIAutomationElement *;[in] IUIAutomationElement *;[out] int )
"CompareRuntimeIds hresult(ptr;ptr;long*);" & _ ;CompareRuntimeIds hresult([in] ne ;[in] ne ;[out] int )
"GetRootElement hresult(ptr*);" & _ ;GetRootElement hresult([out] IUIAutomationElement **)
"ElementFromHandle hresult(none;ptr*);" & _ ;ElementFromHandle hresult([in] void ;[out] IUIAutomationElement **)
"ElementFromPoint hresult(struct;ptr*);" & _ ;ElementFromPoint hresult([in] tagPOINT ;[out] IUIAutomationElement **)
"GetFocusedElement hresult(ptr*);" & _ ;GetFocusedElement hresult([out] IUIAutomationElement **)
"GetRootElementBuildCache hresult(ptr;ptr*);" & _ ;GetRootElementBuildCache hresult([in] IUIAutomationCacheRequest *;[out] IUIAutomationElement **)
"ElementFromHandleBuildCache hresult(none;ptr;ptr*);" & _ ;ElementFromHandleBuildCache hresult([in] void ;[in] IUIAutomationCacheRequest *;[out] IUIAutomationElement **)
"ElementFromPointBuildCache hresult(none;ptr;ptr*);" & _ ;ElementFromPointBuildCache hresult([in] tagPOINT ;[in] IUIAutomationCacheRequest *;[out] IUIAutomationElement **)
"GetFocusedElementBuildCache hresult(ptr;ptr*);" & _ ;GetFocusedElementBuildCache hresult([in] IUIAutomationCacheRequest *;[out] IUIAutomationElement **)
"CreateTreeWalker hresult(ptr;ptr*);" & _ ;CreateTreeWalker hresult([in] IUIAutomationCondition *;[out] IUIAutomationTreeWalker **)
"ControlViewWalker hresult(ptr*);" & _ ;ControlViewWalker hresult([out] IUIAutomationTreeWalker **)
"ContentViewWalker hresult(ptr*);" & _ ;ContentViewWalker hresult([out] IUIAutomationTreeWalker **)
"RawViewWalker hresult(ptr*);" & _ ;RawViewWalker hresult([out] IUIAutomationTreeWalker **)
"RawViewCondition hresult(ptr*);" & _ ;RawViewCondition hresult([out] IUIAutomationCondition **)
"ControlViewCondition hresult(ptr*);" & _ ;ControlViewCondition hresult([out] IUIAutomationCondition **)
"ContentViewCondition hresult(ptr*);" & _ ;ContentViewCondition hresult([out] IUIAutomationCondition **)
"CreateCacheRequest hresult(ptr*);" & _ ;CreateCacheRequest hresult([out] IUIAutomationCacheRequest **)
"CreateTrueCondition hresult(ptr*);" & _ ;CreateTrueCondition hresult([out] IUIAutomationCondition **)
"CreateFalseCondition hresult(ptr*);" & _ ;CreateFalseCondition hresult([out] IUIAutomationCondition **)
"CreatePropertyCondition hresult(int;variant;ptr*);" & _ ;CreatePropertyCondition hresult([in] int ;[in] variant ;[out] IUIAutomationCondition **)
"CreatePropertyConditionEx hresult(int;variant;long;ptr*);" & _ ;CreatePropertyConditionEx hresult([in] int ;[in] variant ;[in] PropertyConditionFlags ;[out] IUIAutomationCondition **)
"CreateAndCondition hresult(ptr;ptr;ptr*);" & _ ;CreateAndCondition hresult([in] IUIAutomationCondition *;[in] IUIAutomationCondition *;[out] IUIAutomationCondition **)
"CreateAndConditionFromArray hresult(ptr;ptr*);" & _ ;CreateAndConditionFromArray hresult([in] IUIAutomationCondition ;[out] IUIAutomationCondition **)
"CreateAndConditionFromNativeArray hresult(ptr;int;ptr*);" & _ ;CreateAndConditionFromNativeArray hresult([in] IUIAutomationCondition **;[in] int ;[out] IUIAutomationCondition **)
"CreateOrCondition hresult(ptr;ptr;ptr*);" & _ ;CreateOrCondition hresult([in] IUIAutomationCondition *;[in] IUIAutomationCondition *;[out] IUIAutomationCondition **)
"CreateOrConditionFromArray hresult(ptr;ptr*);" & _ ;CreateOrConditionFromArray hresult([in] IUIAutomationCondition ;[out] IUIAutomationCondition **)
"CreateOrConditionFromNativeArray hresult(ptr;int;ptr*);" & _ ;CreateOrConditionFromNativeArray hresult([in] IUIAutomationCondition **;[in] int ;[out] IUIAutomationCondition **)
"CreateNotCondition hresult(ptr;ptr*);" & _ ;CreateNotCondition hresult([in] IUIAutomationCondition *;[out] IUIAutomationCondition **)
"AddAutomationEventHandler hresult(int;ptr;long;ptr;ptr);" & _ ;AddAutomationEventHandler hresult([in] int ;[in] IUIAutomationElement *;[in] TreeScope ;[in] IUIAutomationCacheRequest *;[in] IUIAutomationEventHandler *)
"RemoveAutomationEventHandler hresult(int;ptr;ptr);" & _ ;RemoveAutomationEventHandler hresult([in] int ;[in] IUIAutomationElement *;[in] IUIAutomationEventHandler *)
"AddPropertyChangedEventHandlerNativeArray hresult(ptr;long;ptr;ptr;int;int);" & _ ;AddPropertyChangedEventHandlerNativeArray hresult([in] IUIAutomationElement *;[in] TreeScope ;[in] IUIAutomationCacheRequest *;[in] IUIAutomationpropertychangedEventHandler *;[in] int ;[in] int )
"AddPropertyChangedEventHandler hresult(ptr;long;ptr;ptr;ptr);" & _ ;AddPropertyChangedEventHandler hresult([in] IUIAutomationElement *;[in] TreeScope ;[in] IUIAutomationCacheRequest *;[in] IUIAutomationpropertychangedEventHandler *;[in] ne )
"RemovePropertyChangedEventHandler hresult(ptr;ptr);" & _ ;RemovePropertyChangedEventHandler hresult([in] IUIAutomationElement *;[in] IUIAutomationpropertychangedEventHandler *)
"AddStructureChangedEventHandler hresult(ptr;long;ptr;ptr);" & _ ;AddStructureChangedEventHandler hresult([in] IUIAutomationElement *;[in] TreeScope ;[in] IUIAutomationCacheRequest *;[in] IUIAutomationStructureChangedEventHandler *)
"RemoveStructureChangedEventHandler hresult(ptr;ptr);" & _ ;RemoveStructureChangedEventHandler hresult([in] IUIAutomationElement *;[in] IUIAutomationStructureChangedEventHandler *)
"AddFocusChangedEventHandler hresult(ptr;ptr);" & _ ;AddFocusChangedEventHandler hresult([in] IUIAutomationCacheRequest *;[in] IUIAutomationfocusChangedEventHandler *)
"RemoveFocusChangedEventHandler hresult(ptr);" & _ ;RemoveFocusChangedEventHandler hresult([in] IUIAutomationfocusChangedEventHandler *)
"RemoveAllEventHandlers hresult();" & _ ;RemoveAllEventHandlers hresult()
"IntNativeArrayToSafeArray hresult(int;int;ptr*);" & _ ;IntNativeArrayToSafeArray hresult([in] int ;[in] int ;[out] ne )
"IntSafeArrayToNativeArray hresult(ptr;int*;int*);" & _ ;IntSafeArrayToNativeArray hresult([in] ne ;[out] int ;[out] int )
"RectToVariant hresult(none;variant*);" & _ ;RectToVariant hresult([in] tagRECT ;[out] variant )
"VariantToRect hresult(variant;none*);" & _ ;VariantToRect hresult([in] variant ;[out] tagRECT *)
"SafeArrayToRectNativeArray hresult(ptr;none*;int*);" & _ ;SafeArrayToRectNativeArray hresult([in] ne ;[out] tagRECT **;[out] int )
"CreateProxyFactoryEntry hresult(ptr;ptr*);" & _ ;CreateProxyFactoryEntry hresult([in] IUIAutomationProxyFactory *;[out] IUIAutomationProxyFactoryEntry **)
"ProxyFactoryMapping hresult(ptr*);" & _ ;ProxyFactoryMapping hresult([out] IUIAutomationProxyFactoryMapping **)
"GetPropertyProgrammaticName hresult(int;bstr*);" & _ ;GetPropertyProgrammaticName hresult([in] int ;[out] bstr )
"GetPatternProgrammaticName hresult(int;bstr*);" & _ ;GetPatternProgrammaticName hresult([in] int ;[out] bstr )
"PollForPotentialSupportedPatterns hresult(ptr;ptr*;ptr*);" & _ ;PollForPotentialSupportedPatterns hresult([in] IUIAutomationElement *;[out] ne ;[out] ne )
"PollForPotentialSupportedProperties hresult(ptr;ptr*;ptr*);" & _ ;PollForPotentialSupportedProperties hresult([in] IUIAutomationElement *;[out] ne ;[out] ne )
"CheckNotSupported hresult(variant;long*);" & _ ;CheckNotSupported hresult([in] variant ;[out] int )
"ReservedNotSupportedValue hresult(ptr*);" & _ ;ReservedNotSupportedValue hresult([out] iunknown )
"ReservedMixedAttributeValue hresult(ptr*);" & _ ;ReservedMixedAttributeValue hresult([out] iunknown )
"ElementFromIAccessible hresult(none;int;ptr*);" & _ ;ElementFromIAccessible hresult([in] IAccessible *;[in] int ;[out] IUIAutomationElement **)
"ElementFromIAccessibleBuildCache hresult(none;int;ptr;ptr*);" ;ElementFromIAccessibleBuildCache hresult([in] IAccessible *;[in] int ;[in] IUIAutomationCacheRequest *;[out] IUIAutomationElement **)
;===============================================================================

Global Const $sIID_IUIAutomationElement="{D22108AA-8AC5-49A5-837B-37BBB3D7591E}"
Global $dtagIUIAutomationElement = "SetFocus hresult();" & _ ;SetFocus hresult()
"GetRuntimeId hresult(ptr*);" & _ ;GetRuntimeId hresult([out] ne )
"FindFirst hresult(long;ptr;ptr*);" & _ ;FindFirst hresult([in] TreeScope ;[in] IUIAutomationCondition *;[out] IUIAutomationElement **)
"FindAll hresult(long;ptr;ptr*);" & _ ;FindAll hresult([in] TreeScope ;[in] IUIAutomationCondition *;[out] IUIAutomationElementArray **)
"FindFirstBuildCache hresult(long;ptr;ptr;ptr*);" & _ ;FindFirstBuildCache hresult([in] TreeScope ;[in] IUIAutomationCondition *;[in] IUIAutomationCacheRequest *;[out] IUIAutomationElement **)
"FindAllBuildCache hresult(long;ptr;ptr;ptr*);" & _ ;FindAllBuildCache hresult([in] TreeScope ;[in] IUIAutomationCondition *;[in] IUIAutomationCacheRequest *;[out] IUIAutomationElementArray **)
"BuildUpdatedCache hresult(ptr;ptr*);" & _ ;BuildUpdatedCache hresult([in] IUIAutomationCacheRequest *;[out] IUIAutomationElement **)
"GetCurrentPropertyValue hresult(int;variant*);" & _ ;GetCurrentPropertyValue hresult([in] int ;[out] variant )
"GetCurrentPropertyValueEx hresult(int;long;variant*);" & _ ;GetCurrentPropertyValueEx hresult([in] int ;[in] int ;[out] variant )
"GetCachedPropertyValue hresult(int;variant*);" & _ ;GetCachedPropertyValue hresult([in] int ;[out] variant )
"GetCachedPropertyValueEx hresult(int;long;variant*);" & _ ;GetCachedPropertyValueEx hresult([in] int ;[in] int ;[out] variant )
"GetCurrentPatternAs hresult(int;none;none*);" & _ ;GetCurrentPatternAs hresult([in] int ;[in] GUID *;[out] void )
"GetCachedPatternAs hresult(int;none;none*);" & _ ;GetCachedPatternAs hresult([in] int ;[in] GUID *;[out] void )
"GetCurrentPattern hresult(int;ptr*);" & _ ;GetCurrentPattern hresult([in] int ;[out] iunknown )
"GetCachedPattern hresult(int;ptr*);" & _ ;GetCachedPattern hresult([in] int ;[out] iunknown )
"GetCachedParent hresult(ptr*);" & _ ;GetCachedParent hresult([out] IUIAutomationElement **)
"GetCachedChildren hresult(ptr*);" & _ ;GetCachedChildren hresult([out] IUIAutomationElementArray **)
"CurrentProcessId hresult(int*);" & _ ;CurrentProcessId hresult([out] int )
"CurrentControlType hresult(int*);" & _ ;CurrentControlType hresult([out] int )
"CurrentLocalizedControlType hresult(bstr*);" & _ ;CurrentLocalizedControlType hresult([out] bstr )
"CurrentName hresult(bstr*);" & _ ;CurrentName hresult([out] bstr )
"CurrentAcceleratorKey hresult(bstr*);" & _ ;CurrentAcceleratorKey hresult([out] bstr )
"CurrentAccessKey hresult(bstr*);" & _ ;CurrentAccessKey hresult([out] bstr )
"CurrentHasKeyboardFocus hresult(long*);" & _ ;CurrentHasKeyboardFocus hresult([out] int )
"CurrentIsKeyboardFocusable hresult(long*);" & _ ;CurrentIsKeyboardFocusable hresult([out] int )
"CurrentIsEnabled hresult(long*);" & _ ;CurrentIsEnabled hresult([out] int )
"CurrentAutomationId hresult(bstr*);" & _ ;CurrentAutomationId hresult([out] bstr )
"CurrentClassName hresult(bstr*);" & _ ;CurrentClassName hresult([out] bstr )
"CurrentHelpText hresult(bstr*);" & _ ;CurrentHelpText hresult([out] bstr )
"CurrentCulture hresult(int*);" & _ ;CurrentCulture hresult([out] int )
"CurrentIsControlElement hresult(long*);" & _ ;CurrentIsControlElement hresult([out] int )
"CurrentIsContentElement hresult(long*);" & _ ;CurrentIsContentElement hresult([out] int )
"CurrentIsPassword hresult(long*);" & _ ;CurrentIsPassword hresult([out] int )
"CurrentNativeWindowHandle hresult(none*);" & _ ;CurrentNativeWindowHandle hresult([out] void )
"CurrentItemType hresult(bstr*);" & _ ;CurrentItemType hresult([out] bstr )
"CurrentIsOffscreen hresult(long*);" & _ ;CurrentIsOffscreen hresult([out] int )
"CurrentOrientation hresult(long*);" & _ ;CurrentOrientation hresult([out] OrientationType *)
"CurrentFrameworkId hresult(bstr*);" & _ ;CurrentFrameworkId hresult([out] bstr )
"CurrentIsRequiredForForm hresult(long*);" & _ ;CurrentIsRequiredForForm hresult([out] int )
"CurrentItemStatus hresult(bstr*);" & _ ;CurrentItemStatus hresult([out] bstr )
"CurrentBoundingRectangle hresult(none*);" & _ ;CurrentBoundingRectangle hresult([out] tagRECT *)
"CurrentLabeledBy hresult(ptr*);" & _ ;CurrentLabeledBy hresult([out] IUIAutomationElement **)
"CurrentAriaRole hresult(bstr*);" & _ ;CurrentAriaRole hresult([out] bstr )
"CurrentAriaProperties hresult(bstr*);" & _ ;CurrentAriaProperties hresult([out] bstr )
"CurrentIsDataValidForForm hresult(long*);" & _ ;CurrentIsDataValidForForm hresult([out] int )
"CurrentControllerFor hresult(ptr*);" & _ ;CurrentControllerFor hresult([out] IUIAutomationElementArray **)
"CurrentDescribedBy hresult(ptr*);" & _ ;CurrentDescribedBy hresult([out] IUIAutomationElementArray **)
"CurrentFlowsTo hresult(ptr*);" & _ ;CurrentFlowsTo hresult([out] IUIAutomationElementArray **)
"CurrentProviderDescription hresult(bstr*);" & _ ;CurrentProviderDescription hresult([out] bstr )
"CachedProcessId hresult(int*);" & _ ;CachedProcessId hresult([out] int )
"CachedControlType hresult(int*);" & _ ;CachedControlType hresult([out] int )
"CachedLocalizedControlType hresult(bstr*);" & _ ;CachedLocalizedControlType hresult([out] bstr )
"CachedName hresult(bstr*);" & _ ;CachedName hresult([out] bstr )
"CachedAcceleratorKey hresult(bstr*);" & _ ;CachedAcceleratorKey hresult([out] bstr )
"CachedAccessKey hresult(bstr*);" & _ ;CachedAccessKey hresult([out] bstr )
"CachedHasKeyboardFocus hresult(long*);" & _ ;CachedHasKeyboardFocus hresult([out] int )
"CachedIsKeyboardFocusable hresult(long*);" & _ ;CachedIsKeyboardFocusable hresult([out] int )
"CachedIsEnabled hresult(long*);" & _ ;CachedIsEnabled hresult([out] int )
"CachedAutomationId hresult(bstr*);" & _ ;CachedAutomationId hresult([out] bstr )
"CachedClassName hresult(bstr*);" & _ ;CachedClassName hresult([out] bstr )
"CachedHelpText hresult(bstr*);" & _ ;CachedHelpText hresult([out] bstr )
"CachedCulture hresult(int*);" & _ ;CachedCulture hresult([out] int )
"CachedIsControlElement hresult(long*);" & _ ;CachedIsControlElement hresult([out] int )
"CachedIsContentElement hresult(long*);" & _ ;CachedIsContentElement hresult([out] int )
"CachedIsPassword hresult(long*);" & _ ;CachedIsPassword hresult([out] int )
"CachedNativeWindowHandle hresult(none*);" & _ ;CachedNativeWindowHandle hresult([out] void )
"CachedItemType hresult(bstr*);" & _ ;CachedItemType hresult([out] bstr )
"CachedIsOffscreen hresult(long*);" & _ ;CachedIsOffscreen hresult([out] int )
"CachedOrientation hresult(long*);" & _ ;CachedOrientation hresult([out] OrientationType *)
"CachedFrameworkId hresult(bstr*);" & _ ;CachedFrameworkId hresult([out] bstr )
"CachedIsRequiredForForm hresult(long*);" & _ ;CachedIsRequiredForForm hresult([out] int )
"CachedItemStatus hresult(bstr*);" & _ ;CachedItemStatus hresult([out] bstr )
"CachedBoundingRectangle hresult(none*);" & _ ;CachedBoundingRectangle hresult([out] tagRECT *)
"CachedLabeledBy hresult(ptr*);" & _ ;CachedLabeledBy hresult([out] IUIAutomationElement **)
"CachedAriaRole hresult(bstr*);" & _ ;CachedAriaRole hresult([out] bstr )
"CachedAriaProperties hresult(bstr*);" & _ ;CachedAriaProperties hresult([out] bstr )
"CachedIsDataValidForForm hresult(long*);" & _ ;CachedIsDataValidForForm hresult([out] int )
"CachedControllerFor hresult(ptr*);" & _ ;CachedControllerFor hresult([out] IUIAutomationElementArray **)
"CachedDescribedBy hresult(ptr*);" & _ ;CachedDescribedBy hresult([out] IUIAutomationElementArray **)
"CachedFlowsTo hresult(ptr*);" & _ ;CachedFlowsTo hresult([out] IUIAutomationElementArray **)
"CachedProviderDescription hresult(bstr*);" & _ ;CachedProviderDescription hresult([out] bstr )
"GetClickablePoint hresult(none*;long*);" ;GetClickablePoint hresult([out] tagPOINT *;[out] int )
;===============================================================================
;module UIA_PropertyIds
;===============================================================================
Global Const $UIA_RuntimeIdPropertyId=30000
Global Const $UIA_BoundingRectanglePropertyId=30001
Global Const $UIA_ProcessIdPropertyId=30002
Global Const $UIA_ControlTypePropertyId=30003
Global Const $UIA_LocalizedControlTypePropertyId=30004
Global Const $UIA_NamePropertyId=30005
Global Const $UIA_AcceleratorKeyPropertyId=30006
Global Const $UIA_AccessKeyPropertyId=30007
Global Const $UIA_HasKeyboardFocusPropertyId=30008
Global Const $UIA_IsKeyboardFocusablePropertyId=30009
Global Const $UIA_IsEnabledPropertyId=30010
Global Const $UIA_AutomationIdPropertyId=30011
Global Const $UIA_ClassNamePropertyId=30012
Global Const $UIA_HelpTextPropertyId=30013
Global Const $UIA_ClickablePointPropertyId=30014
Global Const $UIA_CulturePropertyId=30015
Global Const $UIA_IsControlElementPropertyId=30016
Global Const $UIA_IsContentElementPropertyId=30017
Global Const $UIA_LabeledByPropertyId=30018
Global Const $UIA_IsPasswordPropertyId=30019
Global Const $UIA_NativeWindowHandlePropertyId=30020
Global Const $UIA_ItemTypePropertyId=30021
Global Const $UIA_IsOffscreenPropertyId=30022
Global Const $UIA_OrientationPropertyId=30023
Global Const $UIA_FrameworkIdPropertyId=30024
Global Const $UIA_IsRequiredForFormPropertyId=30025
Global Const $UIA_ItemStatusPropertyId=30026
Global Const $UIA_IsDockPatternAvailablePropertyId=30027
Global Const $UIA_IsExpandCollapsePatternAvailablePropertyId=30028
Global Const $UIA_IsGridItemPatternAvailablePropertyId=30029
Global Const $UIA_IsGridPatternAvailablePropertyId=30030
Global Const $UIA_IsInvokePatternAvailablePropertyId=30031
Global Const $UIA_IsMultipleViewPatternAvailablePropertyId=30032
Global Const $UIA_IsRangeValuePatternAvailablePropertyId=30033
Global Const $UIA_IsScrollPatternAvailablePropertyId=30034
Global Const $UIA_IsScrollItemPatternAvailablePropertyId=30035
Global Const $UIA_IsSelectionItemPatternAvailablePropertyId=30036
Global Const $UIA_IsSelectionPatternAvailablePropertyId=30037
Global Const $UIA_IsTablePatternAvailablePropertyId=30038
Global Const $UIA_IsTableItemPatternAvailablePropertyId=30039
Global Const $UIA_IsTextPatternAvailablePropertyId=30040
Global Const $UIA_IsTogglePatternAvailablePropertyId=30041
Global Const $UIA_IsTransformPatternAvailablePropertyId=30042
Global Const $UIA_IsValuePatternAvailablePropertyId=30043
Global Const $UIA_IsWindowPatternAvailablePropertyId=30044
Global Const $UIA_ValueValuePropertyId=30045
Global Const $UIA_ValueIsReadOnlyPropertyId=30046
Global Const $UIA_RangeValueValuePropertyId=30047
Global Const $UIA_RangeValueIsReadOnlyPropertyId=30048
Global Const $UIA_RangeValueMinimumPropertyId=30049
Global Const $UIA_RangeValueMaximumPropertyId=30050
Global Const $UIA_RangeValueLargeChangePropertyId=30051
Global Const $UIA_RangeValueSmallChangePropertyId=30052
Global Const $UIA_ScrollHorizontalScrollPercentPropertyId=30053
Global Const $UIA_ScrollHorizontalViewSizePropertyId=30054
Global Const $UIA_ScrollVerticalScrollPercentPropertyId=30055
Global Const $UIA_ScrollVerticalViewSizePropertyId=30056
Global Const $UIA_ScrollHorizontallyScrollablePropertyId=30057
Global Const $UIA_ScrollVerticallyScrollablePropertyId=30058
Global Const $UIA_SelectionselectionPropertyId=30059
Global Const $UIA_SelectionCanSelectMultiplePropertyId=30060
Global Const $UIA_SelectionIsSelectionRequiredPropertyId=30061
Global Const $UIA_GridRowCountPropertyId=30062
Global Const $UIA_GridColumnCountPropertyId=30063
Global Const $UIA_GridItemRowPropertyId=30064
Global Const $UIA_GridItemColumnPropertyId=30065
Global Const $UIA_GridItemRowSpanPropertyId=30066
Global Const $UIA_GridItemColumnSpanPropertyId=30067
Global Const $UIA_GridItemContainingGridPropertyId=30068
Global Const $UIA_DockDockPositionPropertyId=30069
Global Const $UIA_ExpandCollapseExpandCollapseStatePropertyId=30070
Global Const $UIA_MultipleViewCurrentViewPropertyId=30071
Global Const $UIA_MultipleViewSupportedViewsPropertyId=30072
Global Const $UIA_WindowCanMaximizePropertyId=30073
Global Const $UIA_WindowCanMinimizePropertyId=30074
Global Const $UIA_WindowWindowVisualStatePropertyId=30075
Global Const $UIA_WindowWindowInteractionStatePropertyId=30076
Global Const $UIA_WindowIsModalPropertyId=30077
Global Const $UIA_WindowIsTopmostPropertyId=30078
Global Const $UIA_SelectionItemIsSelectedPropertyId=30079
Global Const $UIA_SelectionItemSelectionContainerPropertyId=30080
Global Const $UIA_TableRowHeadersPropertyId=30081
Global Const $UIA_TableColumnHeadersPropertyId=30082
Global Const $UIA_TableRowOrColumnMajorPropertyId=30083
Global Const $UIA_TableItemRowHeaderItemsPropertyId=30084
Global Const $UIA_TableItemColumnHeaderItemsPropertyId=30085
Global Const $UIA_ToggleToggleStatePropertyId=30086
Global Const $UIA_TransformCanMovePropertyId=30087
Global Const $UIA_TransformCanResizePropertyId=30088
Global Const $UIA_TransformCanRotatePropertyId=30089
Global Const $UIA_IsLegacyIAccessiblePatternAvailablePropertyId=30090
Global Const $UIA_LegacyIAccessibleChildIdPropertyId=30091
Global Const $UIA_LegacyIAccessibleNamePropertyId=30092
Global Const $UIA_LegacyIAccessibleValuePropertyId=30093
Global Const $UIA_LegacyIAccessibleDescriptionPropertyId=30094
Global Const $UIA_LegacyIAccessibleRolePropertyId=30095
Global Const $UIA_LegacyIAccessibleStatePropertyId=30096
Global Const $UIA_LegacyIAccessibleHelpPropertyId=30097
Global Const $UIA_LegacyIAccessibleKeyboardShortcutPropertyId=30098
Global Const $UIA_LegacyIAccessibleSelectionPropertyId=30099
Global Const $UIA_LegacyIAccessibleDefaultActionPropertyId=30100
Global Const $UIA_AriaRolePropertyId=30101
Global Const $UIA_AriaPropertiesPropertyId=30102
Global Const $UIA_IsDataValidForFormPropertyId=30103
Global Const $UIA_ControllerForPropertyId=30104
Global Const $UIA_DescribedByPropertyId=30105
Global Const $UIA_FlowsToPropertyId=30106
Global Const $UIA_ProviderDescriptionPropertyId=30107
Global Const $UIA_IsItemContainerPatternAvailablePropertyId=30108
Global Const $UIA_IsVirtualizedItemPatternAvailablePropertyId=30109
Global Const $UIA_IsSynchronizedInputPatternAvailablePropertyId=30110

;~ The main object with acces to the windows automation api 3.0
Global $objUIAutomation = ObjCreateInterface($sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation)
If IsObj($objUIAutomation) Then
    ConsoleWrite("At least it seems we have the core object to start with" & @CRLF)
EndIf

;~ Try to get the desktop as a generic reference/global for all samples
$objUIAutomation.GetRootElement($pDesktop)
;~ $oDesktop = ObjCreateInterface($pDesktop, $dtagIUIAutomationElement)
;~ If IsObj($oDesktop) Then
;~  ConsoleWrite("At least it seems I have the desktop as a frequently used starting point" & @CRLF)
;~ EndIf

$oDesktop = ObjCreateInterface($pDesktop, $sIID_IUIAutomationElement,$dtagIUIAutomationElement)
;~ $oDesktop = ObjCreateInterface($pDesktop, $sIID_IUIAutomationElement,"Default")


If IsObj($oDesktop) Then
    ConsoleWrite("At least it seems I have the desktop as a frequently used starting point"     & "[" & getPVal($oDesktop, $UIA_NamePropertyId) & "][" & getPVal($oDesktop, $UIA_ClassNamePropertyId) & "]" & @CRLF)
EndIf

$objUIAutomation.GetFocusedElement($pUIElement)
$oUIElement = ObjCreateInterface($pUIElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement)
If IsObj($oUIElement) Then
    ConsoleWrite("At least we have an focused element "     & "[" & getPVal($oUIElement, $UIA_NamePropertyId) & "][" & getPVal($oUIElement, $UIA_ClassNamePropertyId) & "]" & @CRLF)
EndIf

while True
    sleep(100)
WEnd

Func GetElementInfo()
Local $hWnd
Local $tStruct = DllStructCreate($tagPOINT) ; Create a structure that defines the point to be checked.
;~ Local $tStruct =_AutoItObject_DllStructCreate($tagPoint)

ToolTip("")

$x=MouseGetPos(0)
$y=MouseGetPos(1)
DllStructSetData($tStruct, "x", $x)
DllStructSetData($tStruct, "y", $y)
;~ consolewrite(DllStructGetData($tStruct,"x") & DllStructGetData($tStruct,"y"))
;~ consolewrite("Mouse position is retrieved " & @crlf)
$objUIAutomation.ElementFromPoint($tStruct,$pUIElement)
;~ $objUIAutomation.ElementFromPoint(DllStructGetPtr($tStruct),$pUIElement)
;~ consolewrite("Element from point is passed, trying to convert to object ")
$oUIElement = objcreateinterface($pUIElement,$sIID_IUIAutomationElement, $dtagIUIAutomationElement)
If IsObj($oUIElement) Then
    ConsoleWrite("At least we have an element "     & "[" & getPVal($oUIElement, $UIA_NamePropertyId) & "][" & getPVal($oUIElement, $UIA_ClassNamePropertyId) & "]" & @CRLF)

ConsoleWrite("All properties: " & @crlf & getAllPropertyValues($oUIElement))

EndIf

EndFunc   ;==>Example

Func Close()
Exit
EndFunc   ;==>Close

;~ Just return a single property or if its an array string them together
func getPVal($obj, $id)
    local $tval
    local $tStr
    local $aCall

     $obj.GetCurrentPropertyValue($Id,$tVal)
;~  $tVal=$aCall[2]
    $tStr=""
    if isarray($tVal) Then
        for $i=0 to ubound($tval)-1
            $tStr=$tStr & $tVal[$i]
            if $i <> ubound($tVal)-1 Then
                $tStr=$tStr & ";"
            endif
        Next
;~      consolewrite($id & " is an array")
        return $tStr
    endIf
    return $tVal
EndFunc
; ~ Just get all available properties for desktop/should work on all IUIAutomationElements depending on ControlTypePropertyID they work yes/no
 ; ~ Just make it a very long string name:= value pairs
func getAllPropertyValues($oUIElement)
    local $tStr, $tSeparator
    $tStr=""
    $tSeparator = @crLF  ; To make sure its not a value you normally will get back for values
    $tStr=$tStr & "UIA_AcceleratorKeyPropertyId :=" & getPVal($oUIElement, $UIA_AcceleratorKeyPropertyId) & $tSeparator ; Shortcut key for the element's default action.
    $tStr=$tStr & "UIA_AccessKeyPropertyId :=" & getPVal($oUIElement, $UIA_AccessKeyPropertyId) & $tSeparator ; Keys used to move focus to a control.
    $tStr=$tStr & "UIA_AriaPropertiesPropertyId :=" & getPVal($oUIElement, $UIA_AriaPropertiesPropertyId) & $tSeparator ; A collection of Accessible Rich Internet Application (ARIA) properties, each consisting of a name/value pair delimited by ‘-’ and ‘ ; ’ (for example, ("checked=true ; disabled=false").
    $tStr=$tStr & "UIA_AriaRolePropertyId :=" & getPVal($oUIElement, $UIA_AriaRolePropertyId) & $tSeparator ; ARIA role information.
    $tStr=$tStr & "UIA_AutomationIdPropertyId :=" & getPVal($oUIElement, $UIA_AutomationIdPropertyId) & $tSeparator ; UI Automation identifier.
    $tStr=$tStr & "UIA_BoundingRectanglePropertyId :=" & getPVal($oUIElement, $UIA_BoundingRectanglePropertyId) & $tSeparator ; Coordinates of the rectangle that completely encloses the element.
    $tStr=$tStr & "UIA_ClassNamePropertyId :=" & getPVal($oUIElement, $UIA_ClassNamePropertyId) & $tSeparator ; Class name of the element as assigned by the control developer.
    $tStr=$tStr & "UIA_ClickablePointPropertyId :=" & getPVal($oUIElement, $UIA_ClickablePointPropertyId) & $tSeparator ; Screen coordinates of any clickable point within the control.
    $tStr=$tStr & "UIA_ControllerForPropertyId :=" & getPVal($oUIElement, $UIA_ControllerForPropertyId) & $tSeparator ; Array of elements controlled by the automation element that supports this property.
    $tStr=$tStr & "UIA_ControlTypePropertyId :=" & getPVal($oUIElement, $UIA_ControlTypePropertyId) & $tSeparator ; Control Type of the element.
    $tStr=$tStr & "UIA_CulturePropertyId :=" & getPVal($oUIElement, $UIA_CulturePropertyId) & $tSeparator ; Locale identifier of the element.
    $tStr=$tStr & "UIA_DescribedByPropertyId :=" & getPVal($oUIElement, $UIA_DescribedByPropertyId) & $tSeparator ; Array of elements that provide more information about the element.
    $tStr=$tStr & "UIA_DockDockPositionPropertyId :=" & getPVal($oUIElement, $UIA_DockDockPositionPropertyId) & $tSeparator ; Docking position.
    $tStr=$tStr & "UIA_ExpandCollapseExpandCollapseStatePropertyId :=" & getPVal($oUIElement, $UIA_ExpandCollapseExpandCollapseStatePropertyId) & $tSeparator ; The expand/collapse state.
    $tStr=$tStr & "UIA_FlowsToPropertyId :=" & getPVal($oUIElement, $UIA_FlowsToPropertyId) & $tSeparator ; Array of elements that suggest the reading order after the corresponding element.
    $tStr=$tStr & "UIA_FrameworkIdPropertyId :=" & getPVal($oUIElement, $UIA_FrameworkIdPropertyId) & $tSeparator ; Underlying UI framework that the element is part of.
    $tStr=$tStr & "UIA_GridColumnCountPropertyId :=" & getPVal($oUIElement, $UIA_GridColumnCountPropertyId) & $tSeparator ; Number of columns.
    $tStr=$tStr & "UIA_GridItemColumnPropertyId :=" & getPVal($oUIElement, $UIA_GridItemColumnPropertyId) & $tSeparator ; Column the item is in.
    $tStr=$tStr & "UIA_GridItemColumnSpanPropertyId :=" & getPVal($oUIElement, $UIA_GridItemColumnSpanPropertyId) & $tSeparator ; number of columns that the item spans.
    $tStr=$tStr & "UIA_GridItemContainingGridPropertyId :=" & getPVal($oUIElement, $UIA_GridItemContainingGridPropertyId) & $tSeparator ; UI Automation provider that implements IGridProvider and represents the container of the cell or item.
    $tStr=$tStr & "UIA_GridItemRowPropertyId :=" & getPVal($oUIElement, $UIA_GridItemRowPropertyId) & $tSeparator ; Row the item is in.
    $tStr=$tStr & "UIA_GridItemRowSpanPropertyId :=" & getPVal($oUIElement, $UIA_GridItemRowSpanPropertyId) & $tSeparator ; Number of rows that the item spzns.
    $tStr=$tStr & "UIA_GridRowCountPropertyId :=" & getPVal($oUIElement, $UIA_GridRowCountPropertyId) & $tSeparator ; Number of rows.
    $tStr=$tStr & "UIA_HasKeyboardFocusPropertyId :=" & getPVal($oUIElement, $UIA_HasKeyboardFocusPropertyId) & $tSeparator ; Whether the element has the keyboard focus.
    $tStr=$tStr & "UIA_HelpTextPropertyId :=" & getPVal($oUIElement, $UIA_HelpTextPropertyId) & $tSeparator ; Additional information about how to use the element.
    $tStr=$tStr & "UIA_IsContentElementPropertyId :=" & getPVal($oUIElement, $UIA_IsContentElementPropertyId) & $tSeparator ; Whether the element appears in the content view of the automation element tree.
    $tStr=$tStr & "UIA_IsControlElementPropertyId :=" & getPVal($oUIElement, $UIA_IsControlElementPropertyId) & $tSeparator ; Whether the element appears in the control view of the automation element tree.
    $tStr=$tStr & "UIA_IsDataValidForFormPropertyId :=" & getPVal($oUIElement, $UIA_IsDataValidForFormPropertyId) & $tSeparator ; Whether the data in a form is valid.
    $tStr=$tStr & "UIA_IsDockPatternAvailablePropertyId :=" & getPVal($oUIElement, $UIA_IsDockPatternAvailablePropertyId) & $tSeparator ; Whether the Dock control pattern is available on the element.
    $tStr=$tStr & "UIA_IsEnabledPropertyId :=" & getPVal($oUIElement, $UIA_IsEnabledPropertyId) & $tSeparator ; Whether the control is enabled.
    $tStr=$tStr & "UIA_IsExpandCollapsePatternAvailablePropertyId :=" & getPVal($oUIElement, $UIA_IsExpandCollapsePatternAvailablePropertyId) & $tSeparator ; Whether the ExpandCollapse control pattern is available on the element.
    $tStr=$tStr & "UIA_IsGridItemPatternAvailablePropertyId :=" & getPVal($oUIElement, $UIA_IsGridItemPatternAvailablePropertyId) & $tSeparator ; Whether the GridItem control pattern is available on the element.
    $tStr=$tStr & "UIA_IsGridPatternAvailablePropertyId :=" & getPVal($oUIElement, $UIA_IsGridPatternAvailablePropertyId) & $tSeparator ; Whether the Grid control pattern is available on the element.
    $tStr=$tStr & "UIA_IsInvokePatternAvailablePropertyId :=" & getPVal($oUIElement, $UIA_IsInvokePatternAvailablePropertyId) & $tSeparator ; Whether the Invoke control pattern is available on the element.
    $tStr=$tStr & "UIA_IsItemContainerPatternAvailablePropertyId :=" & getPVal($oUIElement, $UIA_IsItemContainerPatternAvailablePropertyId) & $tSeparator ; Whether the ItemContainer control pattern is available on the element.
    $tStr=$tStr & "UIA_IsKeyboardFocusablePropertyId :=" & getPVal($oUIElement, $UIA_IsKeyboardFocusablePropertyId) & $tSeparator ; Whether the element can accept the keyboard focus.
    $tStr=$tStr & "UIA_IsLegacyIAccessiblePatternAvailablePropertyId :=" & getPVal($oUIElement, $UIA_IsLegacyIAccessiblePatternAvailablePropertyId) & $tSeparator ; Whether the LegacyIAccessible control pattern is available on the control.
    $tStr=$tStr & "UIA_IsMultipleViewPatternAvailablePropertyId :=" & getPVal($oUIElement, $UIA_IsMultipleViewPatternAvailablePropertyId) & $tSeparator ; Whether the pattern is available on the control.
    $tStr=$tStr & "UIA_IsOffscreenPropertyId :=" & getPVal($oUIElement, $UIA_IsOffscreenPropertyId) & $tSeparator ; Whether the element is scrolled or collapsed out of view.
    $tStr=$tStr & "UIA_IsPasswordPropertyId :=" & getPVal($oUIElement, $UIA_IsPasswordPropertyId) & $tSeparator ; Whether the element contains protected content or a password.
    $tStr=$tStr & "UIA_IsRangeValuePatternAvailablePropertyId :=" & getPVal($oUIElement, $UIA_IsRangeValuePatternAvailablePropertyId) & $tSeparator ; Whether the RangeValue pattern is available on the control.
    $tStr=$tStr & "UIA_IsRequiredForFormPropertyId :=" & getPVal($oUIElement, $UIA_IsRequiredForFormPropertyId) & $tSeparator ; Whether the element is a required field on a form.
    $tStr=$tStr & "UIA_IsScrollItemPatternAvailablePropertyId :=" & getPVal($oUIElement, $UIA_IsScrollItemPatternAvailablePropertyId) & $tSeparator ; Whether the ScrollItem control pattern is available on the element.
    $tStr=$tStr & "UIA_IsScrollPatternAvailablePropertyId :=" & getPVal($oUIElement, $UIA_IsScrollPatternAvailablePropertyId) & $tSeparator ; Whether the Scroll control pattern is available on the element.
    $tStr=$tStr & "UIA_IsSelectionItemPatternAvailablePropertyId :=" & getPVal($oUIElement, $UIA_IsSelectionItemPatternAvailablePropertyId) & $tSeparator ; Whether the SelectionItem control pattern is available on the element.
    $tStr=$tStr & "UIA_IsSelectionPatternAvailablePropertyId :=" & getPVal($oUIElement, $UIA_IsSelectionPatternAvailablePropertyId) & $tSeparator ; Whether the pattern is available on the element.
    $tStr=$tStr & "UIA_IsSynchronizedInputPatternAvailablePropertyId :=" & getPVal($oUIElement, $UIA_IsSynchronizedInputPatternAvailablePropertyId) & $tSeparator ; Whether the SynchronizedInput control pattern is available on the element.
    $tStr=$tStr & "UIA_IsTableItemPatternAvailablePropertyId :=" & getPVal($oUIElement, $UIA_IsTableItemPatternAvailablePropertyId) & $tSeparator ; Whether the TableItem control pattern is available on the element.
    $tStr=$tStr & "UIA_IsTablePatternAvailablePropertyId :=" & getPVal($oUIElement, $UIA_IsTablePatternAvailablePropertyId) & $tSeparator ; Whether the Table conntrol pattern is available on the element.
    $tStr=$tStr & "UIA_IsTextPatternAvailablePropertyId :=" & getPVal($oUIElement, $UIA_IsTextPatternAvailablePropertyId) & $tSeparator ; Whether the Text control pattern is available on the element.
    $tStr=$tStr & "UIA_IsTogglePatternAvailablePropertyId :=" & getPVal($oUIElement, $UIA_IsTogglePatternAvailablePropertyId) & $tSeparator ; Whether the Toggle control pattern is available on the element.
    $tStr=$tStr & "UIA_IsTransformPatternAvailablePropertyId :=" & getPVal($oUIElement, $UIA_IsTransformPatternAvailablePropertyId) & $tSeparator ; Whether the Transform control pattern is available on the element.
    $tStr=$tStr & "UIA_IsValuePatternAvailablePropertyId :=" & getPVal($oUIElement, $UIA_IsValuePatternAvailablePropertyId) & $tSeparator ; Whether the Value control pattern is available on the element.
    $tStr=$tStr & "UIA_IsVirtualizedItemPatternAvailablePropertyId :=" & getPVal($oUIElement, $UIA_IsVirtualizedItemPatternAvailablePropertyId) & $tSeparator ; Whether the VirtualizedItem control pattern is available on the element.
    $tStr=$tStr & "UIA_IsWindowPatternAvailablePropertyId :=" & getPVal($oUIElement, $UIA_IsWindowPatternAvailablePropertyId) & $tSeparator ; Whether the Window control pattern is available on the element.
    $tStr=$tStr & "UIA_ItemStatusPropertyId :=" & getPVal($oUIElement, $UIA_ItemStatusPropertyId) & $tSeparator ; Control-specific status.
    $tStr=$tStr & "UIA_ItemTypePropertyId :=" & getPVal($oUIElement, $UIA_ItemTypePropertyId) & $tSeparator ; Description of the item type, such as "Document File" or "Folder".
    $tStr=$tStr & "UIA_LabeledByPropertyId :=" & getPVal($oUIElement, $UIA_LabeledByPropertyId) & $tSeparator ; Element that contains the text label for this element.
    $tStr=$tStr & "UIA_LegacyIAccessibleChildIdPropertyId :=" & getPVal($oUIElement, $UIA_LegacyIAccessibleChildIdPropertyId) & $tSeparator ; MSAA child ID of the element.
    $tStr=$tStr & "UIA_LegacyIAccessibleDefaultActionPropertyId :=" & getPVal($oUIElement, $UIA_LegacyIAccessibleDefaultActionPropertyId) & $tSeparator ; MSAA default action.
    $tStr=$tStr & "UIA_LegacyIAccessibleDescriptionPropertyId :=" & getPVal($oUIElement, $UIA_LegacyIAccessibleDescriptionPropertyId) & $tSeparator ; MSAA description.
    $tStr=$tStr & "UIA_LegacyIAccessibleHelpPropertyId :=" & getPVal($oUIElement, $UIA_LegacyIAccessibleHelpPropertyId) & $tSeparator ; MSAA help string.
    $tStr=$tStr & "UIA_LegacyIAccessibleKeyboardShortcutPropertyId :=" & getPVal($oUIElement, $UIA_LegacyIAccessibleKeyboardShortcutPropertyId) & $tSeparator ; MSAA shortcut key.
    $tStr=$tStr & "UIA_LegacyIAccessibleNamePropertyId :=" & getPVal($oUIElement, $UIA_LegacyIAccessibleNamePropertyId) & $tSeparator ; MSAA name.
    $tStr=$tStr & "UIA_LegacyIAccessibleRolePropertyId :=" & getPVal($oUIElement, $UIA_LegacyIAccessibleRolePropertyId) & $tSeparator ; MSAA role.
    $tStr=$tStr & "UIA_LegacyIAccessibleSelectionPropertyId :=" & getPVal($oUIElement, $UIA_LegacyIAccessibleSelectionPropertyId) & $tSeparator ; MSAA selection.
    $tStr=$tStr & "UIA_LegacyIAccessibleStatePropertyId :=" & getPVal($oUIElement, $UIA_LegacyIAccessibleStatePropertyId) & $tSeparator ; MSAA state.
    $tStr=$tStr & "UIA_LegacyIAccessibleValuePropertyId :=" & getPVal($oUIElement, $UIA_LegacyIAccessibleValuePropertyId) & $tSeparator ; MSAA value.
    $tStr=$tStr & "UIA_LocalizedControlTypePropertyId :=" & getPVal($oUIElement, $UIA_LocalizedControlTypePropertyId) & $tSeparator ; Localized string describing the control type of element.
    $tStr=$tStr & "UIA_MultipleViewCurrentViewPropertyId :=" & getPVal($oUIElement, $UIA_MultipleViewCurrentViewPropertyId) & $tSeparator ; Current view state of the control.
    $tStr=$tStr & "UIA_MultipleViewSupportedViewsPropertyId :=" & getPVal($oUIElement, $UIA_MultipleViewSupportedViewsPropertyId) & $tSeparator ; Supported control-specific views.
    $tStr=$tStr & "UIA_NamePropertyId :=" & getPVal($oUIElement, $UIA_NamePropertyId) & $tSeparator ; Name of the control.
    $tStr=$tStr & "UIA_NativeWindowHandlePropertyId :=" & getPVal($oUIElement, $UIA_NativeWindowHandlePropertyId) & $tSeparator ; Underlying HWND of the element, if one exists.
    $tStr=$tStr & "UIA_OrientationPropertyId :=" & getPVal($oUIElement, $UIA_OrientationPropertyId) & $tSeparator ; Orientation of the element.
    $tStr=$tStr & "UIA_ProcessIdPropertyId :=" & getPVal($oUIElement, $UIA_ProcessIdPropertyId) & $tSeparator ; Identifier of the process that the element resides in.
    $tStr=$tStr & "UIA_ProviderDescriptionPropertyId :=" & getPVal($oUIElement, $UIA_ProviderDescriptionPropertyId) & $tSeparator ; Description of the UI Automation provider.
    $tStr=$tStr & "UIA_RangeValueIsReadOnlyPropertyId :=" & getPVal($oUIElement, $UIA_RangeValueIsReadOnlyPropertyId) & $tSeparator ; Whether the value is read-only.
    $tStr=$tStr & "UIA_RangeValueLargeChangePropertyId :=" & getPVal($oUIElement, $UIA_RangeValueLargeChangePropertyId) & $tSeparator ; Amount by which the value is adjusted by input such as PgDn.
    $tStr=$tStr & "UIA_RangeValueMaximumPropertyId :=" & getPVal($oUIElement, $UIA_RangeValueMaximumPropertyId) & $tSeparator ; Maximum value in the range.
    $tStr=$tStr & "UIA_RangeValueMinimumPropertyId :=" & getPVal($oUIElement, $UIA_RangeValueMinimumPropertyId) & $tSeparator ; Minimum value in the range.
    $tStr=$tStr & "UIA_RangeValueSmallChangePropertyId :=" & getPVal($oUIElement, $UIA_RangeValueSmallChangePropertyId) & $tSeparator ; Amount by which the value is adjusted by input such as an arrow key.
    $tStr=$tStr & "UIA_RangeValueValuePropertyId :=" & getPVal($oUIElement, $UIA_RangeValueValuePropertyId) & $tSeparator ; Current value.
    $tStr=$tStr & "UIA_RuntimeIdPropertyId :=" & getPVal($oUIElement, $UIA_RuntimeIdPropertyId) & $tSeparator ; Run time identifier of the element.
    $tStr=$tStr & "UIA_ScrollHorizontallyScrollablePropertyId :=" & getPVal($oUIElement, $UIA_ScrollHorizontallyScrollablePropertyId) & $tSeparator ; Whether the control can be scrolled horizontally.
    $tStr=$tStr & "UIA_ScrollHorizontalScrollPercentPropertyId :=" & getPVal($oUIElement, $UIA_ScrollHorizontalScrollPercentPropertyId) & $tSeparator ; How far the element is currently scrolled.
    $tStr=$tStr & "UIA_ScrollHorizontalViewSizePropertyId :=" & getPVal($oUIElement, $UIA_ScrollHorizontalViewSizePropertyId) & $tSeparator ; The viewable width of the control.
    $tStr=$tStr & "UIA_ScrollVerticallyScrollablePropertyId :=" & getPVal($oUIElement, $UIA_ScrollVerticallyScrollablePropertyId) & $tSeparator ; Whether the control can be scrolled vertically.
    $tStr=$tStr & "UIA_ScrollVerticalScrollPercentPropertyId :=" & getPVal($oUIElement, $UIA_ScrollVerticalScrollPercentPropertyId) & $tSeparator ; How far the element is currently scrolled.
    $tStr=$tStr & "UIA_ScrollVerticalViewSizePropertyId :=" & getPVal($oUIElement, $UIA_ScrollVerticalViewSizePropertyId) & $tSeparator ; The viewable height of the control.
    $tStr=$tStr & "UIA_SelectionCanSelectMultiplePropertyId :=" & getPVal($oUIElement, $UIA_SelectionCanSelectMultiplePropertyId) & $tSeparator ; Whether multiple items can be in the selection.
    $tStr=$tStr & "UIA_SelectionIsSelectionRequiredPropertyId :=" & getPVal($oUIElement, $UIA_SelectionIsSelectionRequiredPropertyId) & $tSeparator ; Whether at least one item must be in the selection at all times.
    $tStr=$tStr & "UIA_SelectionselectionPropertyId :=" & getPVal($oUIElement, $UIA_SelectionselectionPropertyId) & $tSeparator ; The items in the selection.
    $tStr=$tStr & "UIA_SelectionItemIsSelectedPropertyId :=" & getPVal($oUIElement, $UIA_SelectionItemIsSelectedPropertyId) & $tSeparator ; Whether the item can be selected.
    $tStr=$tStr & "UIA_SelectionItemSelectionContainerPropertyId :=" & getPVal($oUIElement, $UIA_SelectionItemSelectionContainerPropertyId) & $tSeparator ; The control that contains the item.
    $tStr=$tStr & "UIA_TableColumnHeadersPropertyId :=" & getPVal($oUIElement, $UIA_TableColumnHeadersPropertyId) & $tSeparator ; Collection of column header providers.
    $tStr=$tStr & "UIA_TableItemColumnHeaderItemsPropertyId :=" & getPVal($oUIElement, $UIA_TableItemColumnHeaderItemsPropertyId) & $tSeparator ; Column headers.
    $tStr=$tStr & "UIA_TableRowHeadersPropertyId :=" & getPVal($oUIElement, $UIA_TableRowHeadersPropertyId) & $tSeparator ; Collection of row header providers.
    $tStr=$tStr & "UIA_TableRowOrColumnMajorPropertyId :=" & getPVal($oUIElement, $UIA_TableRowOrColumnMajorPropertyId) & $tSeparator ; Whether the table is primarily organized by row or column.
    $tStr=$tStr & "UIA_TableItemRowHeaderItemsPropertyId :=" & getPVal($oUIElement, $UIA_TableItemRowHeaderItemsPropertyId) & $tSeparator ; Row headers.
    $tStr=$tStr & "UIA_ToggleToggleStatePropertyId :=" & getPVal($oUIElement, $UIA_ToggleToggleStatePropertyId) & $tSeparator ; The toggle state of the control.
    $tStr=$tStr & "UIA_TransformCanMovePropertyId :=" & getPVal($oUIElement, $UIA_TransformCanMovePropertyId) & $tSeparator ; Whether the element can be moved.
    $tStr=$tStr & "UIA_TransformCanResizePropertyId :=" & getPVal($oUIElement, $UIA_TransformCanResizePropertyId) & $tSeparator ; Whether the element can be resized.
    $tStr=$tStr & "UIA_TransformCanRotatePropertyId :=" & getPVal($oUIElement, $UIA_TransformCanRotatePropertyId) & $tSeparator ; Whether the element can be rotated.
    $tStr=$tStr & "UIA_ValueIsReadOnlyPropertyId :=" & getPVal($oUIElement, $UIA_ValueIsReadOnlyPropertyId) & $tSeparator ; Whether the value is read-only.
    $tStr=$tStr & "UIA_ValueValuePropertyId :=" & getPVal($oUIElement, $UIA_ValueValuePropertyId) & $tSeparator ; Current value.
    $tStr=$tStr & "UIA_WindowCanMaximizePropertyId :=" & getPVal($oUIElement, $UIA_WindowCanMaximizePropertyId) & $tSeparator ; Whether the window can be maximized.
    $tStr=$tStr & "UIA_WindowCanMinimizePropertyId :=" & getPVal($oUIElement, $UIA_WindowCanMinimizePropertyId) & $tSeparator ; Whether the window can be minimized.
    $tStr=$tStr & "UIA_WindowIsModalPropertyId :=" & getPVal($oUIElement, $UIA_WindowIsModalPropertyId) & $tSeparator ; Whether the window is modal.
    $tStr=$tStr & "UIA_WindowIsTopmostPropertyId :=" & getPVal($oUIElement, $UIA_WindowIsTopmostPropertyId) & $tSeparator ; Whether the window is on top of other windows.
    $tStr=$tStr & "UIA_WindowWindowInteractionStatePropertyId :=" & getPVal($oUIElement, $UIA_WindowWindowInteractionStatePropertyId) & $tSeparator ; Whether the window can receive input.
    $tStr=$tStr & "UIA_WindowWindowVisualStatePropertyId :=" & getPVal($oUIElement, $UIA_WindowWindowVisualStatePropertyId) & $tSeparator ; Whether the window is maximized, minimized, or restored (normal).
    return $tStr
endFunc
Link to comment
Share on other sites

I can't get a hold of SDK for windows 7.

But I ran your spy it found it under 2 instances - Hmm.. intrigued! I am trying to understand this.

UIA_TransformCanResizePropertyId :=False

UIA_TransformCanRotatePropertyId :=False

UIA_ValueIsReadOnlyPropertyId :=False

UIA_ValueValuePropertyId :=01/31/2013

UIA_WindowCanMaximizePropertyId :=False

UIA_WindowCanMinimizePropertyId :=False

UIA_WindowIsModalPropertyId :=False

...

UIA_LegacyIAccessibleSelectionPropertyId :=

UIA_LegacyIAccessibleStatePropertyId :=0

UIA_LegacyIAccessibleValuePropertyId :=01/31/2013

UIA_LocalizedControlTypePropertyId :=edit

UIA_MultipleViewCurrentViewPropertyId :=0

UIA_MultipleViewSupportedViewsPropertyId :=

Edited by Mun
Link to comment
Share on other sites

I can't get a hold of SDK for windows 7.

I looked in mine and it does not have inspect.exe anyway.

that msdn article says it's installed with win 8 sdk.

"Inspect is installed with the Windows Software Development Kit (SDK) for Windows 8."

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I think I need some pointer or two.

Can I search the element directly without going through desktop?

[control hwnd] â–º [element name]

** EDIT ** I'm gonna throw in my towel before I completely hijack zfisherdrums full fledged .net handles finder.

I thought handling control text/caption would be less overhead.

I spend all days reading about ui automatic and I came to the conclusion that it not worth it.

Getting all win32 messaging to find the controls and interact with them way too much to find 1 controller.

And you have to re-instantiate controls in order to get updated data on them. Wah no way...

Thank you for your support and valor effort.

Edited by Mun
Link to comment
Share on other sites

You have to fully understand ValeryVal that conceptual and implementation are 2 entire worlds apart.

I have read all about UIA and understand how its interpret and no doubt the capability that Microsoft wishes it to achieved.

It would completely be sensible for me to code this in C++ but then still with that I have to write out all my own logic for it yet about 5 yrs + no one not many ever successfully utilized this on a big scale for the mass users.

Better understanding documentation of UI Automation.

Me, the little one, just want something simple and this isn't the way to go.

Edited by Mun
Link to comment
Share on other sites

Mun,

Lets continue within the thread of ui automation. With the library itself its not real hard to get the .NET control. The library includes finding controls etc.

This part you have to read and try to understand

its not real difficult within AutoIt to do UIAutomation but I will try to add more examples to the other thread and some wrappers to make it a litlle easier/comparable to regular AutoIT GUI_xxxx commands

Edited by junkew
Link to comment
Share on other sites

  • 4 years later...

Hi!

 

I have just been using autoit for a few weeks and I am at the point where I can do a lot, but I cannot get information to specify controls for a .net program.  So this forum message seems appropriate.  I downloaded DotNetIdentification.au3 and I also downloaded a free .net program to test it with.  The link for the program is http://dineshbajajktn.blogspot.ca/2012/12/biller.html  I installed it (praying that it doesn't have any viruses) and ran it.  Then I tried running a simple .au3 script with the following code:

#include <DotNetIdentification.au3>
NET_DumpAllControlNames( "Biller")

My output in the consolie is:

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "F:\Autoit\DotNetIdentification.au3" /UserParams    
+>01:09:19 Starting AutoIt3Wrapper v.16.612.1119.0 SciTE v.3.6.6.0   Keyboard:00000409  OS:WIN_10/  CPU:X64 OS:X64  Environment(Language:0409)  CodePage:0  utf8.auto.check:4
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\Phil\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\Phil\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.14.2)  from:C:\Program Files (x86)\AutoIt3  input:F:\Autoit\DotNetIdentification.au3
+>01:09:20 AU3Check ended.rc:0
>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "F:\Autoit\DotNetIdentification.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
+>01:09:20 AutoIt3.exe ended.rc:0
+>01:09:20 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 1.347
 


I have also tried the autoit window info.  It seems to read my controls properly but when I use autoit window info on 
another .net I do not get information that I can use to identify the control I need to access.

I am really stuck and I am also confused by what is meant by window title (presumably "Biller" and what is meant by windowtext (should that be blank)

 

FYI I would use the classnn data provided by the autoit window info program except it changes from run to run of my program.

Thanks . . .

Phil

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...