Jump to content

Recommended Posts

About a year ago I made a UI automation library but still wondering if it cannot be more easily done without usage AutoITObject

Any input on background why below will not work with AutoIT ObjCreate and UIAutomationcore.dll library (W7 32 and 64 bits)

Basically I am trying to create

1. CUIAutomation object

2. As there is normally no registrykey with this UIAutomationCore.DLL the only workaround is to use CLSID (as within C++ we call CoCreateInstance



UI Automation API is not having a com object in registry registered and as such also in VBA createobject will not work (needs a progid) as opposed to NEW statement

Code sample I tried so far (latest version of AutoIt)

HotKeySet("{ESC}", "Terminate")
;********** THIS WORKS *******************
;~ $oExcel = ObjCreate("Excel.Application")                ; Create an Excel Object
;~ $oExcel.Visible = 1                                      ; Let Excel show itself
;~ $oExcel2 = ObjCreate("{00024500-0000-0000-C000-000000000046}")                  ; Create an Excel Object
;~ $oExcel2.Visible = 1                                     ; Let Excel show itself
;********** THIS WORKS NOT ***************
; $oCUIAutomation=ObjCreate("{30CBE57D-D9D0-452A-AB13-7AC5AC4825EE}")
; $oCUIAutomation=ObjCreate("{ff48dba4-60ef-4201-aa87-54103eef594e}")
; $oCUIAutomation=ObjCreate("{944DE083-8FB8-45CF-BCB7-C477ACB2F897}")
; $oCUIAutomation=ObjCreate("{FF48DBA4-60EF-4201-AA87-54103EEF594E}")
;~ $oCUIAutomation=ObjCreate("FF48DBA4-60EF-4201-AA87-54103EEF594E")
;~ Trial when registry keys are added
;~ $oCUIAutomation=ObjCreate("CUIAutomation.Application")
;~ if isobj($oCUIAutomation) Then
;~  msgbox "Hello cuiautomation"
;~ endIf
while True
Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

;~  Windows Registry Editor Version 5.00
;~ [HKEY_CLASSES_ROOT\CUIAutomation.Application]
;~ @="Microsoft UI Automation Application"
;~ [HKEY_CLASSES_ROOT\CUIAutomation.Application\CLSID]
;~ @="{FF48DBA4-60EF-4201-AA87-54103EEF594E}"
;~ [HKEY_CLASSES_ROOT\CUIAutomation.Application\CurVer]
;~ @="CUIAutomation.Application.7"

;~ VBA samples
;~ Works without registry modifications
;~ Sub test()
;~   Dim c As New CUIAutomation
;~   Debug.Print c.GetRootElement.CurrentClassName
;~ End Sub
;~ Works when registry is modified
;~  Sub test()
;~   Dim c As CUIAutomation
;~   Set c = CreateObject("CUIAutomation.Application")
;~   Debug.Print c.GetRootElement.CurrentClassName
;~ End Sub
Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...