Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/03/2023 in all areas

  1. Works for me until the GetCaretRange method. There is a bug in the UIA_Constants.au3. The definition should be : "GetCaretRange hresult(bool*;ptr*);" So the call is : $Pattern.GetCaretRange($bool, $Caret_Position) Now I do not know why you cannot get the pattern object. I tested successfully on Google Chrome and Windows File Explorer (search box). On Win10 here.
    2 points
  2. Version v2.2.0

    1,417 downloads

    Encryption / Decryption / Hashing / Signing Purpose Cryptography API: Next Generation (CNG) is Microsoft's long-term replacement for their CryptoAPI. Microsoft's CNG is designed to be extensible at many levels and cryptography agnostic in behavior. Although the Crypt.au3 UDF lib that is installed with AutoIt3 still works well, the advapi32.dll functions that it uses have been deprecated. In addition the Crypt.au3 UDF lib, as it is currently written, has a very limited ability to decrypt AES data that was not encrypted using Crypt.au3 functions. That is because Crypt.au3 functions do not allow you to specify an actual key or initialization vector (IV). It only lets you specify data to be used to derive a key and uses a static IV. This UDF was created to offer a replacement for the deprecated functions used by Crypt.au3. According to Microsoft, deprecated functions may be removed in future release. It was also created to allow more flexibility and functionality in encryption/decryption/hashing/signing and to expand the ability for users to implement cryptography in their scripts. Description This UDF implements some of Microsoft's Cryptography API: Next Generation (CNG) Win32 API functions. It implements functions to encrypt/decrypt text and files, generate hashes, derive keys using Password-Based Key Derivation Function 2 (PBKDF2), create and verify signatures, and has several cryptography-related helper functions. The UDF can implement any encryption/decryption algorithms and hashing algorithms that are supported by the installed cryptography providers on the PC in which it is running. Most, if not all, of the "magic number" values that you would commonly use to specify that desired algorithms, key bit lengths, and other magic number type values, are already defined as constants or enums in the UDF file. To flatten the learning curve, there is an example file that shows examples of all of the major functionality. This example file is not created to be an exhaustive set of how to implement each feature and parameter. It is designed to give you a template or guide to help you hit the ground running in terms of using the functions. I have tried to fully document the headers of all of the functions as well as the code within the functions themselves. As of v1.4.0, there is also a Help file that includes all of the functions, with examples. Current UDF Functions Algorithm-Specific Symmetric Encryption/Decryption Functions _CryptoNG_AES_CBC_EncryptData _CryptoNG_AES_CBC_DecryptData _CryptoNG_AES_CBC_EncryptFile _CryptoNG_AES_CBC_DecryptFile _CryptoNG_AES_ECB_EncryptData _CryptoNG_AES_ECB_DecryptData _CryptoNG_AES_GCM_EncryptData _CryptoNG_AES_GCM_DecryptData _CryptoNG_3DES_CBC_EncryptData _CryptoNG_3DES_CBC_DecryptData _CryptoNG_3DES_CBC_EncryptFile _CryptoNG_3DES_CBC_DecryptFile Generic Symmetric Encryption/Decryption Functions _CryptoNG_EncryptData _CryptoNG_DecryptData _CryptoNG_EncryptFile _CryptoNG_DecryptFile Hashing Functions _CryptoNG_HashData _CryptoNG_HashFile _CryptoNG_PBKDF2 Asymmetric (Public/Private Key) Cryptography Functions _CryptoNG_ECDSA_CreateKeyPair _CryptoNG_ECDSA_SignHash _CryptoNG_ECDSA_VerifySignature _CryptoNG_RSA_CreateKeyPair _CryptoNG_RSA_EncryptData _CryptoNG_RSA_DecryptData _CryptoNG_RSA_SignHash _CryptoNG_RSA_VerifySignature Misc / Helper Functions _CryptoNG_CryptBinaryToString _CryptoNG_CryptStringToBinary _CryptoNG_GenerateRandom _CryptoNG_EnumAlgorithms _CryptoNG_EnumRegisteredProviders _CryptoNG_EnumKeyStorageProviders _CryptoNG_LastErrorMessage _CryptoNG_Version Related Links Cryptography API: Next Generation - Main Page Cryptography API: Next Generation - Reference Cryptography API: Next Generation - Primitives Cryptography API: Next Generation - Cryptographic Algorithm Providers
    1 point
  3. I tried an earlier version as well. Unimpressed enough that I have not bothered looking at anything since. Windows 11 is, in my experience, a turd for the corporate setting. So I find myself wondering how well something that aspires to mimic that turd will ever do; the devs' good intentions notwithstanding.
    1 point
  4. Well... I Think you don't need different ways to delete a file. You need to be notified when a file is created, then you can delete it. https://www.autoitscript.com/autoit3/docs/libfunctions/_WinAPI_FindFirstChangeNotification.htm Look examples on the helpFile. Cheers!
    1 point
  5. Nine

    Video in GUI 2023 solution?

    Another way with Media Player (no need of UDF) : #include <Constants.au3> #include <StructureConstants.au3> #include <GUIConstants.au3> Local $hGui = GUICreate("WMPlayer", 800, 600) Local $oPlayer = ObjCreate("WMPlayer.OCX") If Not IsObj($oPlayer) Then Exit MsgBox($MB_SYSTEMMODAL, "WMPlayer.OCX", "Cannot create a WMP object.", 5) GUICtrlCreateObj($oPlayer, 0, 0, 800, 600) With $oPlayer .URL = "Your path here.wmv" ; $sFullPath .uiMode = "none" .settings.mute = False EndWith While $oPlayer.playState = 9 Sleep(50) WEnd GUISetState() ResizeOCX($oPlayer, 0, 0, 800, 600) While $oPlayer.playState = 3 ; 1 - stopped, 2 - paused, 3 - playing Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func ResizeOCX($oObject, $iLeft, $iTop, $iRight, $iBottom) Local Const $tagIOleInPlaceObj = _ "ContextSensitiveHelp none(int); " & _ "GetWindow none(ptr); " & _ "InPlaceDeactivate none(); " & _ "ReactivateAndUndo none(); " & _ "SetObjectRects none(ptr; ptr;); " & _ "UIDeactivate none();" Local $oIInPlace = ObjCreateInterface($oObject, "{00000113-0000-0000-C000-000000000046}", $tagIOleInPlaceObj) Local $tRect = DllStructCreate($tagRECT) $tRect.Left = $iLeft $tRect.Top = $iTop $tRect.Right = $iRight $tRect.Bottom = $iBottom Local $pRect = DllStructGetPtr($tRect) $oIInPlace.SetObjectRects($pRect, $pRect) EndFunc ;==>ResizeOCX
    1 point
  6. IAccessible2. IAccessible2.au3 below contains structures, constants, enumerations and interface descriptions to implement IAccessible2 interfaces (IAccessible2 API Version 1.3 released autumn 2012). See post #146 for conditions to use IAccessible2. The main IAccessible2 interface is IAccessible2. You get an IAccessible2 interface pointer by using QueryService from an IAccessible object as described in post #146. This is shown in the example below. From the IAccessible2 main object, you get pointers to the other interfaces with the usual QueryInterface method. Shown in the example. An exception is IAccessibleApplication. You can't use QueryInterface in all cases. Then you have to use QueryService. Also shown in the example. The example recursively walks through all the objects of a top window. For each object it creates IAccessible and IAccessible2 interfaces. For each IAccessible2 main interface it tries to get pointers for the other IAccessible2 interfaces. If it succeeds various information is extracted. (You would normally not use a recursive procedure in a real automation event. You would try to find the object in a more direct way.) Press Ctrl+w when the mouse is over a window. Results are shown with _ArrayDisplay. The array can contain several thousands rows. Give it a few seconds to fill the array. #include "CUIAutomation2.au3" #include "MSAccessibility.au3" #include "IAccessible2.au3" #include <Array.au3> Opt( "MustDeclareVars", 1 ) Global $aInfo[10000], $iInfo = 0 Global $fAccessibleApplication MainFunc() Func MainFunc() HotKeySet( "^w", "GetWindowInfo" ) HotKeySet( "{ESC}", "Close" ) While Sleep(100) WEnd EndFunc Func GetWindowInfo() Local $aMousePos = MouseGetPos(), $pObject, $tVarChild, $vt, $err = 0 If AccessibleObjectFromPoint( $aMousePos[0], $aMousePos[1], $pObject, $tVarChild ) = $S_OK Then $vt = BitAND( DllStructGetData( $tVarChild, 1, 1 ), 0xFFFF ) If $vt = $VT_I4 Then Local $oObject, $hWnd, $sName = "" If WindowFromAccessibleObject( $pObject, $hWnd ) = $S_OK Then AccessibleObjectFromWindow( $hWnd, $OBJID_CLIENT, $tIID_IAccessible, $pObject ) $oObject = ObjCreateInterface( $pObject, $sIID_IAccessible, $dtagIAccessible ) ; Get parent objects to top window Local $pParent, $pPrev, $oPrev, $iRole Do $pPrev = $pParent $oPrev = $oObject $oObject.get_accParent( $pParent ) $oObject = ObjCreateInterface( $pParent, $sIID_IAccessible, $dtagIAccessible ) $oObject.get_accName( $CHILDID_SELF, $sName ) Until String( $sName ) = "Desktop" ; Info for top window (previous to desktop) PrintElementInfoToArray( $pPrev, $oPrev, $CHILDID_SELF, "" ) ; Info for child objects of the top window If $oPrev.get_accRole( $CHILDID_SELF, $iRole ) = $S_OK And $iRole = $ROLE_SYSTEM_WINDOW Then WindowFromAccessibleObject( $pPrev, $hWnd ) PrintWindowObjects( $hWnd ) Else $err = 1 EndIf Else $err = 1 EndIf Else $err = 1 EndIf Else $err = 1 EndIf If $err Then _ MsgBox( 0, "IAccessible2 interfaces", _ "AccessibleObjectFromPoint failed." & @CRLF & _ "Try another point e.g. the window title bar." ) EndFunc Func PrintWindowObjects( $hWindow ) ; Object from window Local $pWindow, $oWindow AccessibleObjectFromWindow( $hWindow, $OBJID_CLIENT, $tIID_IAccessible, $pWindow ) $oWindow = ObjCreateInterface( $pWindow, $sIID_IAccessible, $dtagIAccessible ) If Not IsObj( $oWindow ) Then Return ; Get window objects $fAccessibleApplication = False WalkTreeWithAccessibleChildren( $pWindow, 0, 8 ) ; Print window objects ReDim $aInfo[$iInfo] _ArrayDisplay( $aInfo, "IAccessible2 interfaces" ) ReDim $aInfo[10000] $iInfo = 0 EndFunc Func WalkTreeWithAccessibleChildren( $pAcc, $iLevel, $iLevels = 0 ) If $iLevels And $iLevel = $iLevels Then Return ; Create object Local $oAcc = ObjCreateInterface( $pAcc, $sIID_IAccessible, $dtagIAccessible ) If Not IsObj( $oAcc ) Then Return $oAcc.AddRef() ; Indentation Local $sIndent = "" For $i = 0 To $iLevel - 1 $sIndent &= " " Next Local $iChildCount, $iReturnCount, $tVarChildren ; Get children If $oAcc.get_accChildCount( $iChildCount ) Or Not $iChildCount Then Return If AccessibleChildren( $pAcc, 0, $iChildCount, $tVarChildren, $iReturnCount ) Then Return Local $vt, $pChildObj, $oChildObj, $iChildElem, $iRole, $hWnd Local $pService, $oService, $pAccessible2, $oAccessible2, $iComStatus, $fShowError = False Local $iIA2Relations, $pRelation, $oRelation, $sIA2RelationType, $iIA2Role, $sIA2Attributes ; Interfaces Local $pAccessible2_2, $pAccessibleAction, $pAccessibleApplication, $pAccessibleComponent, $pAccessibleDocument, $pAccessibleEditableText Local $pAccessibleText, $pAccessibleText2, $pAccessibleHypertext, $pAccessibleHypertext2, $pAccessibleHyperlink, $pAccessibleImage Local $pAccessibleRelation, $pAccessibleTable, $pAccessibleTable2, $pAccessibleTableCell, $pAccessibleValue Local $oAccessibleAction, $iIA2Actions, $sIA2ActionName Local $oAccessibleApplication, $sIA2AppName, $sIA2AppVersion, $sIA2ToolkitName, $sIA2ToolkitVersion Local $oAccessibleHypertext, $iIA2Hyperlinks, $pHyperlink, $oHyperlink, $sIA2HyperlinkName ; For each child For $i = 1 To $iReturnCount ; $tVarChildren is an array of VARIANTs with information about the children $vt = BitAND( DllStructGetData( $tVarChildren, $i, 1 ), 0xFFFF ) If $vt = $VT_DISPATCH Then ; Child object $pChildObj = DllStructGetData( $tVarChildren, $i, 3 ) $oChildObj = ObjCreateInterface( $pChildObj, $sIID_IAccessible, $dtagIAccessible ) If IsObj( $oChildObj ) Then ; Try to get an IAccessible2 interface pointer for the child object If $oChildObj.QueryInterface( DllStructGetPtr( $tIID_IServiceProvider ), $pService ) = $S_OK Then $oService = ObjCreateInterface( $pService, $sIID_IServiceProvider, $dtagIServiceProvider ) If $oService.QueryService( $tIID_IAccessible2, $tIID_IAccessible2, $pAccessible2 ) = $S_OK Then $aInfo[$iInfo] = $sIndent & "$pAccessible2 = " & Ptr( $pAccessible2 ) $iInfo += 1 $oAccessible2 = ObjCreateInterface( $pAccessible2, $sIID_IAccessible2, $dtagIAccessible2 ) If IsObj( $oAccessible2 ) Then ; $oAccessible2.role $oAccessible2.role( $iIA2Role ) If $iIA2Role > 0x400 Then $aInfo[$iInfo] = $sIndent & "$iIA2Role = " & GetIA2Role( $iIA2Role ) Else $aInfo[$iInfo] = $sIndent & "$iIA2Role = 0x" & Hex( $iIA2Role ) EndIf $iInfo += 1 ; $oAccessible2.nRelations $oAccessible2.nRelations( $iIA2Relations ) $aInfo[$iInfo] = $sIndent & "$iIA2Relations = " & $iIA2Relations $iInfo += 1 For $j = 0 To $iIA2Relations - 1 $oAccessible2.relation( $j, $pRelation ) If $pRelation Then $oRelation = ObjCreateInterface( $pRelation, $sIID_IAccessibleRelation, $dtagIAccessibleRelation ) $oRelation.relationType( $sIA2RelationType ) $aInfo[$iInfo] = $sIndent & "$sIA2RelationType = " & $sIA2RelationType $iInfo += 1 EndIf Next ; $oAccessible2.attributes $oAccessible2.attributes( $sIA2Attributes ) $aInfo[$iInfo] = $sIndent & "$sIA2Attributes = " & $sIA2Attributes $iInfo += 1 ; IAccessible2_2 interface (QueryInterface) $iComStatus = $oAccessible2.QueryInterface( DllStructGetPtr( $tIID_IAccessible2_2 ), $pAccessible2_2 ) If $iComStatus = $S_OK Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessible2_2 = " & Ptr( $pAccessible2_2 ) $iInfo += 1 ElseIf $fShowError Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessible2_2 = Error: " & Hex( $iComStatus ) $iInfo += 1 EndIf ; IAccessibleAction interface (QueryInterface) $iComStatus = $oAccessible2.QueryInterface( DllStructGetPtr( $tIID_IAccessibleAction ), $pAccessibleAction ) If $iComStatus = $S_OK Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleAction = " & Ptr( $pAccessibleAction ) $iInfo += 1 $oAccessibleAction = ObjCreateInterface( $pAccessibleAction, $sIID_IAccessibleAction, $dtagIAccessibleAction ) $oAccessibleAction.nActions( $iIA2Actions ) If $iIA2Actions Then $aInfo[$iInfo] = " " & $sIndent & "$iIA2Actions = " & $iIA2Actions $iInfo += 1 For $j = 0 To $iIA2Actions - 1 $oAccessibleAction.name( $j, $sIA2ActionName ) $aInfo[$iInfo] = " " & $sIndent & "$sIA2ActionName = " & $sIA2ActionName $iInfo += 1 Next EndIf ElseIf $fShowError Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleAction = Error: " & Hex( $iComStatus ) $iInfo += 1 EndIf ; IAccessibleApplication interface (QueryInterface) If Not $fAccessibleApplication Then $iComStatus = $oAccessible2.QueryInterface( DllStructGetPtr( $tIID_IAccessibleApplication ), $pAccessibleApplication ) If $iComStatus = $S_OK Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleApplication = " & Ptr( $pAccessibleApplication ) $iInfo += 1 $oAccessibleApplication = ObjCreateInterface( $pAccessibleApplication, $sIID_IAccessibleApplication, $dtagIAccessibleApplication ) $oAccessibleApplication.appName( $sIA2AppName ) $oAccessibleApplication.appVersion( $sIA2AppVersion ) $oAccessibleApplication.toolkitName( $sIA2ToolkitName ) $oAccessibleApplication.toolkitVersion( $sIA2ToolkitVersion ) $aInfo[$iInfo+0] = " " & $sIndent & "$sIA2AppName = " & $sIA2AppName $aInfo[$iInfo+1] = " " & $sIndent & "$sIA2AppVersion = " & $sIA2AppVersion $aInfo[$iInfo+2] = " " & $sIndent & "$sIA2ToolkitName = " & $sIA2ToolkitName $aInfo[$iInfo+3] = " " & $sIndent & "$sIA2ToolkitVersion = " & $sIA2ToolkitVersion $iInfo += 4 $fAccessibleApplication = True ElseIf $fShowError Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleApplication = Error: " & Hex( $iComStatus ) $iInfo += 1 EndIf If $iComStatus <> $S_OK Then ; IAccessibleApplication interface (QueryService) $iComStatus = $oService.QueryService( $tIID_IAccessibleApplication, $tIID_IAccessibleApplication, $pAccessibleApplication ) If $iComStatus = $S_OK Then $aInfo[$iInfo] = $sIndent & "QueryService $pAccessibleApplication = " & Ptr( $pAccessibleApplication ) $iInfo += 1 $oAccessibleApplication = ObjCreateInterface( $pAccessibleApplication, $sIID_IAccessibleApplication, $dtagIAccessibleApplication ) $oAccessibleApplication.appName( $sIA2AppName ) $oAccessibleApplication.appVersion( $sIA2AppVersion ) $oAccessibleApplication.toolkitName( $sIA2ToolkitName ) $oAccessibleApplication.toolkitVersion( $sIA2ToolkitVersion ) $aInfo[$iInfo+0] = " " & $sIndent & "$sIA2AppName = " & $sIA2AppName $aInfo[$iInfo+1] = " " & $sIndent & "$sIA2AppVersion = " & $sIA2AppVersion $aInfo[$iInfo+2] = " " & $sIndent & "$sIA2ToolkitName = " & $sIA2ToolkitName $aInfo[$iInfo+3] = " " & $sIndent & "$sIA2ToolkitVersion = " & $sIA2ToolkitVersion $iInfo += 4 $fAccessibleApplication = True ElseIf $fShowError Then $aInfo[$iInfo] = $sIndent & "QueryService $pAccessibleApplication = Error: " & Hex( $iComStatus ) $iInfo += 1 EndIf EndIf EndIf ; IAccessibleComponent interface (QueryInterface) $iComStatus = $oAccessible2.QueryInterface( DllStructGetPtr( $tIID_IAccessibleComponent ), $pAccessibleComponent ) If $iComStatus = $S_OK Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleComponent = " & Ptr( $pAccessibleComponent ) $iInfo += 1 ElseIf $fShowError Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleComponent = Error: " & Hex( $iComStatus ) $iInfo += 1 EndIf ; IAccessibleDocument interface (QueryInterface) $iComStatus = $oAccessible2.QueryInterface( DllStructGetPtr( $tIID_IAccessibleDocument ), $pAccessibleDocument ) If $iComStatus = $S_OK Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleDocument = " & Ptr( $pAccessibleDocument ) $iInfo += 1 ElseIf $fShowError Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleDocument = Error: " & Hex( $iComStatus ) $iInfo += 1 EndIf ; IAccessibleEditableText interface (QueryInterface) $iComStatus = $oAccessible2.QueryInterface( DllStructGetPtr( $tIID_IAccessibleEditableText ), $pAccessibleEditableText ) If $iComStatus = $S_OK Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleEditableText = " & Ptr( $pAccessibleEditableText ) $iInfo += 1 ElseIf $fShowError Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleEditableText = Error: " & Hex( $iComStatus ) $iInfo += 1 EndIf ; IAccessibleText interface (QueryInterface) $iComStatus = $oAccessible2.QueryInterface( DllStructGetPtr( $tIID_IAccessibleText ), $pAccessibleText ) If $iComStatus = $S_OK Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleText = " & Ptr( $pAccessibleText ) $iInfo += 1 ElseIf $fShowError Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleText = Error: " & Hex( $iComStatus ) $iInfo += 1 EndIf ; IAccessibleText2 interface (QueryInterface) $iComStatus = $oAccessible2.QueryInterface( DllStructGetPtr( $tIID_IAccessibleText2 ), $pAccessibleText2 ) If $iComStatus = $S_OK Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleText2 = " & Ptr( $pAccessibleText2 ) $iInfo += 1 ElseIf $fShowError Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleText2 = Error: " & Hex( $iComStatus ) $iInfo += 1 EndIf ; IAccessibleHypertext interface (QueryInterface) $iComStatus = $oAccessible2.QueryInterface( DllStructGetPtr( $tIID_IAccessibleHypertext ), $pAccessibleHypertext ) If $iComStatus = $S_OK Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleHypertext = " & Ptr( $pAccessibleHypertext ) $iInfo += 1 $oAccessibleHypertext = ObjCreateInterface( $pAccessibleHypertext, $sIID_IAccessibleHypertext, $dtagIAccessibleHypertext ) $oAccessibleHypertext.nHyperlinks( $iIA2Hyperlinks ) If $iIA2Hyperlinks Then $aInfo[$iInfo] = " " & $sIndent & "$iIA2Hyperlinks = " & $iIA2Hyperlinks $iInfo += 1 For $j = 0 To $iIA2Hyperlinks - 1 $oAccessibleHypertext.hyperlink( $j, $pHyperlink ) If $pHyperlink Then $oHyperlink = ObjCreateInterface( $pHyperlink, $sIID_IAccessibleHyperlink, $dtagIAccessibleHyperlink ) $oHyperlink.name( $sIA2HyperlinkName ) $aInfo[$iInfo+0] = " " & $sIndent & "$iHyperlink = " & $j $aInfo[$iInfo+1] = " " & $sIndent & "$sIA2HyperlinkName = " & $sIA2HyperlinkName $iInfo += 2 EndIf Next EndIf ElseIf $fShowError Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleHypertext = Error: " & Hex( $iComStatus ) $iInfo += 1 EndIf ; IAccessibleHypertext2 interface (QueryInterface) $iComStatus = $oAccessible2.QueryInterface( DllStructGetPtr( $tIID_IAccessibleHypertext2 ), $pAccessibleHypertext2 ) If $iComStatus = $S_OK Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleHypertext2 = " & Ptr( $pAccessibleHypertext2 ) $iInfo += 1 ElseIf $fShowError Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleHypertext2 = Error: " & Hex( $iComStatus ) $iInfo += 1 EndIf ; IAccessibleHyperlink interface (QueryInterface) $iComStatus = $oAccessible2.QueryInterface( DllStructGetPtr( $tIID_IAccessibleHyperlink ), $pAccessibleHyperlink ) If $iComStatus = $S_OK Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleHyperlink = " & Ptr( $pAccessibleHyperlink ) $iInfo += 1 ElseIf $fShowError Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleHyperlink = Error: " & Hex( $iComStatus ) $iInfo += 1 EndIf ; IAccessibleImage interface (QueryInterface) $iComStatus = $oAccessible2.QueryInterface( DllStructGetPtr( $tIID_IAccessibleImage ), $pAccessibleImage ) If $iComStatus = $S_OK Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleImage = " & Ptr( $pAccessibleImage ) $iInfo += 1 ElseIf $fShowError Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleImage = Error: " & Hex( $iComStatus ) $iInfo += 1 EndIf ; IAccessibleRelation interface (QueryInterface) $iComStatus = $oAccessible2.QueryInterface( DllStructGetPtr( $tIID_IAccessibleRelation ), $pAccessibleRelation ) If $iComStatus = $S_OK Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleRelation = " & Ptr( $pAccessibleRelation ) $iInfo += 1 ElseIf $fShowError Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleRelation = Error: " & Hex( $iComStatus ) $iInfo += 1 EndIf ; IAccessibleTable interface (QueryInterface) $iComStatus = $oAccessible2.QueryInterface( DllStructGetPtr( $tIID_IAccessibleTable ), $pAccessibleTable ) If $iComStatus = $S_OK Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleTable = " & Ptr( $pAccessibleTable ) $iInfo += 1 ElseIf $fShowError Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleTable = Error: " & Hex( $iComStatus ) $iInfo += 1 EndIf ; IAccessibleTable2 interface (QueryInterface) $iComStatus = $oAccessible2.QueryInterface( DllStructGetPtr( $tIID_IAccessibleTable2 ), $pAccessibleTable2 ) If $iComStatus = $S_OK Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleTable2 = " & Ptr( $pAccessibleTable2 ) $iInfo += 1 ElseIf $fShowError Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleTable2 = Error: " & Hex( $iComStatus ) $iInfo += 1 EndIf ; IAccessibleTableCell interface (QueryInterface) $iComStatus = $oAccessible2.QueryInterface( DllStructGetPtr( $tIID_IAccessibleTableCell ), $pAccessibleTableCell ) If $iComStatus = $S_OK Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleTableCell = " & Ptr( $pAccessibleTableCell ) $iInfo += 1 ElseIf $fShowError Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleTableCell = Error: " & Hex( $iComStatus ) $iInfo += 1 EndIf ; IAccessibleValue interface (QueryInterface) $iComStatus = $oAccessible2.QueryInterface( DllStructGetPtr( $tIID_IAccessibleValue ), $pAccessibleValue ) If $iComStatus = $S_OK Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleValue = " & Ptr( $pAccessibleValue ) $iInfo += 1 ElseIf $fShowError Then $aInfo[$iInfo] = $sIndent & "QueryInterface $pAccessibleValue = Error: " & Hex( $iComStatus ) $iInfo += 1 EndIf EndIf EndIf EndIf PrintElementInfoToArray( $pChildObj, $oChildObj, $CHILDID_SELF, $sIndent ) WalkTreeWithAccessibleChildren( $pChildObj, $iLevel + 1, $iLevels ) EndIf EndIf Next EndFunc Func PrintElementInfoToArray( $pElement, $oElement, $iChild, $sIndent ) Local $hWnd, $sName, $iRole, $sRole, $iRoleLen Local $iState, $sState, $iStateLen Local $sValue, $x, $y, $w, $h If $iChild <> $CHILDID_SELF Then $aInfo[$iInfo] = $sIndent & "$iChildElem = " & $iChild $iInfo += 1 EndIf If $iChild = $CHILDID_SELF And $oElement.get_accRole( $CHILDID_SELF, $iRole ) = $S_OK And $iRole = $ROLE_SYSTEM_WINDOW Then WindowFromAccessibleObject( $pElement, $hWnd ) $aInfo[$iInfo] = $sIndent & "$hWnd = " & $hWnd $iInfo += 1 EndIf $oElement.get_accName( $iChild, $sName ) $aInfo[$iInfo] = $sIndent & "$sName = " & $sName $iInfo += 1 If $oElement.get_accRole( $iChild, $iRole ) = $S_OK Then $aInfo[$iInfo] = $sIndent & "$iRole = 0x" & Hex( $iRole ) $iInfo += 1 $iRoleLen = GetRoleText( $iRole, 0, 0 ) + 1 $sRole = DllStructCreate( "wchar[" & $iRoleLen & "]" ) GetRoleText( $iRole, DllStructGetPtr( $sRole ), $iRoleLen ) $aInfo[$iInfo] = $sIndent & "$sRole = " & DllStructGetData( $sRole, 1 ) $iInfo += 1 EndIf If $oElement.get_accState( $iChild, $iState ) = $S_OK Then $aInfo[$iInfo] = $sIndent & "$iState = 0x" & Hex( $iState ) $iInfo += 1 $iStateLen = GetStateText( $iState, 0, 0 ) + 1 $sState = DllStructCreate( "wchar[" & $iStateLen & "]" ) GetStateText( $iState, DllStructGetPtr( $sState ), $iStateLen ) $aInfo[$iInfo] = $sIndent & "$sState = " & DllStructGetData( $sState, 1 ) $iInfo += 1 EndIf If $oElement.get_accValue( $iChild, $sValue ) = $S_OK Then $aInfo[$iInfo] = $sIndent & "$sValue = " & $sValue $iInfo += 1 EndIf IF $oElement.accLocation( $x, $y, $w, $h, $iChild ) = $S_OK Then $aInfo[$iInfo] = $sIndent & "$x, $y, $w, $h = " & $x & ", " & $y & ", " & $w & ", " & $h $iInfo += 1 EndIf $aInfo[$iInfo] = "" $iInfo += 1 EndFunc Func Close() Exit EndFunc The example is tested with Firefox, Chrome and Opera. For Firefox accessibility mode is enabled by default. For Chrome and Opera accessibility mode is enabled when you Press Ctrl+w when the mouse is over the window title bar (looking for IAccessible interfaces seems to enable accessibility mode). For Opera you have to Press Ctrl+w once more to get all results. The textbox shows a small part of the output from the AutoIt home site (http://www.autoitscript.com/site/). The textbox contains info about the top window for the three browsers, the first object with application info, and the AutoIt logo object in the upper left corner. Mozilla Firefox =============== $hWnd = 0x00020508 $sName = AutoItScript - AutoItScript Website - Mozilla Firefox $iRole = 0x00000009 $sRole = window $iState = 0x00160004 $sState = focusable $x, $y, $w, $h = 212, 84, 1200, 937 $pAccessible2 = 0x00C3EDF4 $iIA2Role = 0x0000000B $iIA2Relations = 2 $sIA2RelationType = containingDocument $sIA2RelationType = containingApplication $sIA2Attributes = margin-left:0px;text-align:start;text-indent:0px;id:tabContextMenu;tag:menupopup;margin-right:0px;margin-top:0px;margin-bottom:0px;display:-moz-popup; QueryInterface $pAccessible2_2 = 0x00C2805C QueryInterface $pAccessibleAction = 0x00C8BF9C QueryService $pAccessibleApplication = 0x00C284DC $sIA2AppName = Firefox $sIA2AppVersion = 27.0.1 $sIA2ToolkitName = Gecko $sIA2ToolkitVersion = 27.0.1 QueryInterface $pAccessibleComponent = 0x00C28C74 $sName = 0 $iRole = 0x0000000B $sRole = popup menu $iState = 0x00019400 $sState = offscreen $x, $y, $w, $h = 216, 114, 0, 0 $pAccessible2 = 0x00BB2EF4 $iIA2Role = 0x00000028 $iIA2Relations = 3 $sIA2RelationType = containingDocument $sIA2RelationType = containingTabPane $sIA2RelationType = containingApplication $sIA2Attributes = margin-left:0px;src:http\://aut1.autoit-cdn.com/site/wp-content/themes/TheCorporation/images/logo@2x.png;text-align:left;draggable:true;text-indent:0px;id:logo;tag:img;margin-right:10px;margin-top:0px;margin-bottom:0px;display:block;explicit-name:true; QueryInterface $pAccessible2_2 = 0x00BB6D5C QueryInterface $pAccessibleAction = 0x033B700C $iIA2Actions = 1 $sIA2ActionName = jump QueryInterface $pAccessibleComponent = 0x033B7304 QueryInterface $pAccessibleHyperlink = 0x00BADFA4 QueryInterface $pAccessibleImage = 0x033B75AC $sName = AutoItScript $iRole = 0x00000028 $sRole = graphic $iState = 0x00C01000 $sState = traversed $sValue = http://www.autoitscript.com/site/ $x, $y, $w, $h = 324, 197, 210, 72 Google Chrome ============= $hWnd = 0x000304B2 $sName = AutoItScript - AutoItScript Website - Google Chrome $iRole = 0x00000009 $sRole = window $iState = 0x00160004 $sState = focusable $x, $y, $w, $h = 212, 84, 1200, 936 $pAccessible2 = 0x00BA8CC4 $iIA2Role = 0x0000000F $iIA2Relations = 0 $sIA2Attributes = tag:#document QueryInterface $pAccessibleApplication = 0x00C9F14C $sIA2AppName = Chrome $sIA2AppVersion = 33.0.1750.117 $sIA2ToolkitName = Chrome $sIA2ToolkitVersion = Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36 QueryInterface $pAccessibleText = 0x00B8CA54 QueryInterface $pAccessibleHypertext = 0x00B436BC $iIA2Hyperlinks = 26 $iHyperlink = 0 $sIA2HyperlinkName = $iHyperlink = 1 $sIA2HyperlinkName = $iHyperlink = 2 $sIA2HyperlinkName = $iHyperlink = 3 $sIA2HyperlinkName = $iHyperlink = 4 $sIA2HyperlinkName = $iHyperlink = 5 $sIA2HyperlinkName = $iHyperlink = 6 $sIA2HyperlinkName = $iHyperlink = 7 $sIA2HyperlinkName = $iHyperlink = 8 $sIA2HyperlinkName = $iHyperlink = 9 $sIA2HyperlinkName = $iHyperlink = 10 $sIA2HyperlinkName = $iHyperlink = 11 $sIA2HyperlinkName = $iHyperlink = 12 $sIA2HyperlinkName = $iHyperlink = 13 $sIA2HyperlinkName = $iHyperlink = 14 $sIA2HyperlinkName = $iHyperlink = 15 $sIA2HyperlinkName = $iHyperlink = 16 $sIA2HyperlinkName = $iHyperlink = 17 $sIA2HyperlinkName = $iHyperlink = 18 $sIA2HyperlinkName = $iHyperlink = 19 $sIA2HyperlinkName = $iHyperlink = 20 $sIA2HyperlinkName = $iHyperlink = 21 $sIA2HyperlinkName = $iHyperlink = 22 $sIA2HyperlinkName = $iHyperlink = 23 $sIA2HyperlinkName = $iHyperlink = 24 $sIA2HyperlinkName = $iHyperlink = 25 $sIA2HyperlinkName = QueryInterface $pAccessibleHyperlink = 0x00B4350C $sName = AutoItScript - AutoItScript Website $iRole = 0x0000000F $sRole = document $iState = 0x00100044 $sState = focusable $sValue = http://www.autoitscript.com/site/ $x, $y, $w, $h = 217, 185, 1175, 1112 $pAccessible2 = 0x00C12DCC $iIA2Role = 0x0000001E $iIA2Relations = 0 $sIA2Attributes = display:inline;tag:a QueryInterface $pAccessibleText = 0x00C96414 QueryInterface $pAccessibleHypertext = 0x00C5F104 $iIA2Hyperlinks = 1 $iHyperlink = 0 $sIA2HyperlinkName = QueryInterface $pAccessibleHyperlink = 0x02670904 $sName = AutoItScript $iRole = 0x0000001E $sRole = link $iState = 0x00D10000 $sState = traversed $sValue = http://www.autoitscript.com/site/ $x, $y, $w, $h = 324, 185, 211, 72 $pAccessible2 = 0x00B6F594 $iIA2Role = 0x00000028 $iIA2Relations = 0 $sIA2Attributes = display:block;tag:img QueryInterface $pAccessibleText = 0x00CD81BC QueryInterface $pAccessibleHypertext = 0x00B4362C QueryInterface $pAccessibleHyperlink = 0x00CAC93C QueryInterface $pAccessibleImage = 0x0267A09C $sName = AutoItScript $iRole = 0x00000028 $sRole = graphic $iState = 0x00400040 $sState = linked $sValue = http://aut1.autoit-cdn.com/site/wp-content/themes/TheCorporation/images/logo@2x.png $x, $y, $w, $h = 325, 185, 211, 72 Opera browser ============= $hWnd = 0x0006050E $sName = AutoItScript - AutoItScript Website - Opera $iRole = 0x00000009 $sRole = window $iState = 0x00160000 $sState = focusable $x, $y, $w, $h = 213, 85, 1198, 935 $pAccessible2 = 0x00BB1F44 $iIA2Role = 0x0000000F $iIA2Relations = 0 $sIA2Attributes = tag:#document QueryInterface $pAccessibleApplication = 0x026DACBC $sIA2AppName = OPR $sIA2AppVersion = 19.0.1326.63 $sIA2ToolkitName = Chrome $sIA2ToolkitVersion = Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36 OPR/19.0.1326.63 QueryInterface $pAccessibleText = 0x0284C95C QueryInterface $pAccessibleHypertext = 0x0284C9A4 $iIA2Hyperlinks = 26 $iHyperlink = 0 $sIA2HyperlinkName = $iHyperlink = 1 $sIA2HyperlinkName = $iHyperlink = 2 $sIA2HyperlinkName = $iHyperlink = 3 $sIA2HyperlinkName = $iHyperlink = 4 $sIA2HyperlinkName = $iHyperlink = 5 $sIA2HyperlinkName = $iHyperlink = 6 $sIA2HyperlinkName = $iHyperlink = 7 $sIA2HyperlinkName = $iHyperlink = 8 $sIA2HyperlinkName = $iHyperlink = 9 $sIA2HyperlinkName = $iHyperlink = 10 $sIA2HyperlinkName = $iHyperlink = 11 $sIA2HyperlinkName = $iHyperlink = 12 $sIA2HyperlinkName = $iHyperlink = 13 $sIA2HyperlinkName = $iHyperlink = 14 $sIA2HyperlinkName = $iHyperlink = 15 $sIA2HyperlinkName = $iHyperlink = 16 $sIA2HyperlinkName = $iHyperlink = 17 $sIA2HyperlinkName = $iHyperlink = 18 $sIA2HyperlinkName = $iHyperlink = 19 $sIA2HyperlinkName = $iHyperlink = 20 $sIA2HyperlinkName = $iHyperlink = 21 $sIA2HyperlinkName = $iHyperlink = 22 $sIA2HyperlinkName = $iHyperlink = 23 $sIA2HyperlinkName = $iHyperlink = 24 $sIA2HyperlinkName = $iHyperlink = 25 $sIA2HyperlinkName = QueryInterface $pAccessibleHyperlink = 0x0292F6EC $sName = AutoItScript - AutoItScript Website $iRole = 0x0000000F $sRole = document $iState = 0x00100044 $sState = focusable $sValue = http://www.autoitscript.com/site/ $x, $y, $w, $h = 219, 177, 1169, 1112 $pAccessible2 = 0x03269F8C $iIA2Role = 0x0000001E $iIA2Relations = 0 $sIA2Attributes = display:inline;tag:a QueryInterface $pAccessibleText = 0x028A1964 QueryInterface $pAccessibleHypertext = 0x00B6E014 $iIA2Hyperlinks = 1 $iHyperlink = 0 $sIA2HyperlinkName = QueryInterface $pAccessibleHyperlink = 0x00BA4E44 $sName = AutoItScript $iRole = 0x0000001E $sRole = link $iState = 0x00D10000 $sState = traversed $sValue = http://www.autoitscript.com/site/ $x, $y, $w, $h = 323, 177, 211, 72 $pAccessible2 = 0x02769AEC $iIA2Role = 0x00000028 $iIA2Relations = 0 $sIA2Attributes = display:block;tag:img QueryInterface $pAccessibleText = 0x031F980C QueryInterface $pAccessibleHypertext = 0x0287EB84 QueryInterface $pAccessibleHyperlink = 0x00CE4A8C QueryInterface $pAccessibleImage = 0x027C86DC $sName = AutoItScript $iRole = 0x00000028 $sRole = graphic $iState = 0x00400040 $sState = linked $sValue = http://aut1.autoit-cdn.com/site/wp-content/themes/TheCorporation/images/logo@2x.png $x, $y, $w, $h = 324, 177, 211, 72 Note that Firefox treats the logo as a single graphic object with a jump action, while Chrome and Opera treats the logo as a main link object with a child graphic object. Note also that Opera is based on the Chrome toolkit. You need MSAccessibility.au3 and IAccessible2.au3. You also need the new (smallest) version of CUIAutomation2.au3 in first post.
    1 point
×
×
  • Create New...