autoHotkey进阶---用于访问窗口对象-acc库的简单配置

阅读: 评论:0

autoHotkey进阶---⽤于访问窗⼝对象-acc库的简单配置
⽂章⽬录
autoHotkey进阶 — ⽤于访问窗⼝对象-acc库的简单配置
引⾔
accessible( acc) 库,是ahk的⼀个第三⽅的代码库.这个库通过访问微软库的底层api函数(Microsoft Active Accessibility (MSAA))实现⼀些窗⼝的基础操作函数.从名字也可以看出来,主要是让我们访问窗⼝的⼀些对象. 例如⽤于监测窗⼝\控件\gui元素的信息. 根据这些信息做⼀些特殊操作,或者操作这些对象的状态. 例如检测按钮的位置,并设置⾃动单击.
Microsoft Active Accessibility (MSAA) 是⽤于⽤户界⾯可访问性的应⽤程序编程接⼝ (API)。MSAA于1997年作为Microsoft Windows 95的平台附加组件引⼊。MSAA 旨在帮助辅助技术 (AT) 产品与应⽤程序(或操作系统)的标准和⾃定义⽤户界⾯ (UI) 元素进⾏交互,以及访问、识别和操作应⽤程序的 UI 元素。AT 产品与⽀持 MSAA 的应⽤程序配合使⽤,以便为有⾝体或认知困难、障碍或残疾的个⼈提供更好的访问。AT 产品的⼀些⽰例包括:⽤于视⼒受限⽤户的屏幕阅读器、适⽤于物理访问受限⽤户的屏幕键盘或⽤于听⼒受限⽤户的讲述⼈。MSAA还可⽤于⾃动化测试⼯具和基于计算机的培训应⽤程序。—
参考博客列表
1.
配置过程
1. 下载github的代码
2. 解压缩得到下⾯的
3. 将AccV2.ahk 复制到和⾃⼰的脚本同个⽂件夹下.
也有介绍说把这个库直接放在ahk软件的库⾥⾯的. 我暂时没有采⽤这种⽅法.
5. 在⾃⼰脚本的开头引⼊上⾯的脚本,这样就可以⽤acc的函数了. 函数介绍看下⾯,或者打开 accV2.ahk脚本,在开头有英⽂介绍.
资源
这个下⾯有很多这个作者的案例脚本,⾃⼰可以查阅
函数列表
;----------------------------------------------------------------------------------------------------------------------
; Acc.ahk
;----------------------------------------------------------------------------------------------------------------------
; Authors  (dd/mm/yyyy):
;  Sean    ()
;  jethrow (19/02/2012)
;  Sancarn (26/11/2017,18/01/2019,10/05/2019)
;----------------------------------------------------------------------------------------------------------------------
密封杯;
CHANGE LOG:
;----------------------------------------------------------------------------------------------------------------------
;19/02/2012:
;    Modified ComObjEnwrap params from (9,pacc) -->(9,pacc,1)
;    Changed ComObjUnwrap to ComObjValue in order to avoid AddRef (thanks fincs)
;    Added Acc_GetRoleText & Acc_GetStateText
;    Added additional functions - commented below
;    Removed original Acc_Children function
;26/11/2017:
;    Added Enumerations as Objects
;    Added IAccessible walking
;
        acc_childrenFilter(oAcc, ACC_FILTERS.byDescription, "Amazing button")
;
线内钩子
;        acc_childrenFilter(oAcc, Func("myAwesomeFunction"), true)
;        myAwesomeFunction(oAcc,val){
清砂机;return val
;}
;    Added Acc_ChildProxy to Acc_Children
;18/01/2019:
;    Documentation Update
;10/05/2019:
;    Error Checking to ACC_ChildProxy
;
----------------------------------------------------------------------------------------------------------------------
;ACC INTELLISENSE PACK:
;----------------------------------------------------------------------------------------------------------------------
;IAcc Member Properties: [accChild,accChildCount,accDefaultAction,accDescription,accFocus,accHelp,accHelpTopic,accKeyboardShortcut,accName,accP arent,accRole,accSelection,accState,accValue]
;Member Methods:        [accDoDefaultAction,accHitTest,accLocation,accNavigate,accSelect]
;Global Constants:      [ACC_NAVDIR,ACC_SELECTIONFLAG,ACC_EVENT,VT_CONSTANTS,ACC_FILTERS,ACC_OBJID,ACC_STATE,ACC_ROLE]
;Global Methods:        [Acc_ObjectFromEvent,Acc_ObjectFromPoint,Acc_ObjectFromWindow,Acc_WindowFromObject,Acc_SetWinEventHook,Acc_Unhoo kWinEvent,Acc_Location,Acc_Parent,Acc_Child,Acc_Children,Acc_Get,acc_childrenFilter,acc_getRootElement]
;
;----------------------------------------------------------------------------------------------------------------------
; DOCUMENTATION:
;----------------------------------------------------------------------------------------------------------------------
;IAcc Member Properties:
;  accChild                Read-only        An IDispatch interface for the specified child, if one exists. All objects must support this property. See get_accChild.
;  accChildCount          Read-only        The number of children that belong to this object. All objects must support this property. See get_accChildCount.
;  accDefaultAction        Read-only        A string that describes the object's default action. Not all objects have a default action. See get_accDefaultAction. ;  accDescription          Read-only        Note  The accDescription property is not supported in the transition to UI Automation. Microsoft Active Accessibility s ervers and applications should not use it. A string that describes the visual appearance of the specified object. Not all objects have a description.
;
  accFocus                Read-only        The object that has the keyboard focus. All objects that receive the keyboard focus must support this property. See ge t_accFocus.
;  accHelp                Read-only        A help string. Not all objects support this property. See get_accHelp.
;  accHelpTopic            Read-only        Note  The accHelpTopic property is deprecated and should not be used.The full path of the help file associated with the specified object and the identifier of the appropriate topic within that file. Not all objects support this property.
;  accKeyboardShortcut    Read-only        The object's shortcut key or access key, also known as the mnemonic. All objects that have a shortcut key or an access key support this property. See get_accKeyboardShortcut.
;  accName                Read-only        The name of the object. All objects support this property. See get_accName.
;  accParent              Read-only        The IDispatch interface of the object's parent. All objects support this property. See get_accParent.
;
  accRole                Read-only        Information that describes the role of the specified object. All objects support this property. See get_accRole.
;  accSelection            Read-only        The selected children of this object. All objects that support selection must support this property. See get_accSelectio n.
;  accState                Read-only        The current state of the object. All objects support this property. See get_accState.
;  accValue                Read/write      The value of the object. Not all objects have a value. See get_accValue, put_accValue.
;Member Methods:
;  accDoDefaultAction                      Performs the specified object's default action. Not all objects have a default action.
;  accHitTest                              Retrieves the child element or child object at a given point on the screen. All visual objects support this method.
;
  accLocation                              Retrieves the specified object's current screen location. All visual objects support this method.
;  accNavigate                              Note  The accNavigate method is deprecated and should not be used. Clients should use other methods and properties s uch as AccessibleChildren, get_accChild, get_accParent, and IEnumVARIANT. Traverses to another user interface element within a container and retrieve s the object. All visual objects support this method.
;  accSelect                                Modifies the selection or moves the keyboard focus of the specified object. All objects that support selection or receive the keyboard focus must support this method.
;Global Constants:
;  ACC_NAVDIR                              Object containing different navigation direction flags.
;  ACC_SELECTIONFLAG                        Object containing different accSelect() Flags.
;  ACC_EVENT                                Object containing different windows events which can be used with Acc_ObjectFromEvent.
;  VT_CONSTANTS                            Object containing different COM VTable constants.
;  ACC_FILTERS                              Object containing filter functions to be used with acc_childrenFilter.
;  ACC_OBJID                                Object containing different object names and ids.
;  ACC_STATE                                Object containing different state names and ids.
;  ACC_ROLE                                Object containing different role names and ids.
;Global Methods:
;  Acc_ObjectFromEvent(ByRef _idChild_, hWnd, idObject, idChild)                                    - Used to get Acc object from Event
;  Acc_ObjectFromPoint(ByRef _idChild_ = "", x = "", y = "")                                        - Used to get Acc object from X,Y Point
;  Acc_ObjectFromWindow(hWnd, idObject = -4)                                                        - Used to get Acc object from hWND
;
  Acc_WindowFromObject(pacc)                                                                      - Used to get hWND from ACC object
;  Acc_WindowFromObject(pacc)                                                                      - Used to get hWND from ACC object
;  Acc_SetWinEventHook(eventMin, eventMax, pCallback)                                              - Listen for Windows events. Call callback with Acc object param. ;  Acc_UnhookWinEvent(hHook)                                                                        - Stop listening to existing event hook.
;  Acc_Location(Acc, ChildId=0)                                                                    - Get the location of an IAccessible object
;  Acc_Parent(Acc)                                                                                  - Get the parent object of an element
;  Acc_Child(Acc, ChildId=0)                                                                        - Get a child of the object with a specified id.
;  Acc_Children(Acc)                                                                                - Get the children of an IAcce
ssible object (as an array)
测绘工具;  Acc_Get(Cmd, ChildPath="", ChildID=0, WinTitle="", WinText="", ExcludeTitle="", ExcludeText="")  - Get an accessible object
;  acc_childrenFilter(oAcc, fCondition, value=0, returnOne=false, obj=0)                            - Filter children by some defined condition
;  acc_getRootElement()                                                                            - Returns the Acc Object for the Desktop (Root of all Acc tree elements)
;DEPRECATED AND INTERNAL METHODS:
;  Acc_Init()                                                                                      - DO NOT CALL!
;  Acc_Query(Acc)                                                                                  - DO NOT CALL! Query IAccessible interface from object
;  Acc_Error(p="")                                                                                  - DO NOT CALL! Error information
;  Acc_GetRoleText(nRole)                                                                          - [DEPRECATED. USE ACC_ROLE OBJECT  ] Get's ACC Role as Text.
;  Acc_GetStateText(nState)                                                                        - [DEPRECATED. USE ACC_STATE OBJECT  ] Get's ACC State as Text.
;  Acc_Role(Acc, ChildId=0)                                                                        - [DEPRECATED. USE ACC_ROLE OBJECT  ]
;  Acc_State(Acc, ChildId=0)                                                                        - [DEPRECATED. USE ACC_STATE OBJECT  ]
;  Acc_ChildrenByRole(Acc, Role)                                                                    - [DEPRECATED. USE acc_childrenFilter] Get all children of the specified role. ;  acc_childrenByName(oAccessible, name,returnOne=false)                                            - [DEPRECATED. USE acc_childrenFilter]Filter children by name, i f returnOne then only 1 child is returned
;
;----------------------------------------------------------------------------------------------------------------------
双模卡;Further descriptions:
;----------------------------------------------------------------------------------------------------------------------
;acc_childrenFilter
;  Filters the children in an acc object and calls the function defined by the 2nd parameter with Acc object and the 3rd param.
;  If the function returns true, the child is included in the filter.
;Example:
; The following function will include children based on the 3rd parameter:
;      acc_childrenFilter(oAcc, Func("myAwesomeFunction"), true);Returns all children
;  acc_childrenFilter(oAcc, Func("myAwesomeFunction"), true);Returns no  children
;      myAwesomeFunction(oAcc,val){
;return val
;}
;
;ACC_FILTERS
;  These are commonly used in conjunction with `acc_childrenFilter`:
;Example:
;  acc_childrenFilter(oAcc, ACC_FILTERS.byDescription, "Amazing button")
;List of helper methods:
;  ACC_FILTERS.byDefaultAction(oAcc,action) - Filter children by a specific default action
;  ACC_FILTERS.byDescription(oAcc,desc)    - Filter children by a specific description
;  ACC_FILTERS.byValue(oAcc, value)        - Filter children by a specific value
;  ACC_FILTERS.byHelp(oAcc, hlpTxt)        - Filter children by a specific help text旋转倒立摆
;
  ACC_FILTERS.byState(oAcc, state)        - Filter children by a specific state
;  ACC_FILTERS.byRole(oAcc, role)          - Filter children by a specific role
;  ACC_FILTERS.byName(oAcc, name)          - Filter children by a specific name
;  ACC_FILTERS.byRegex(oAcc, regex)        - Filter children by regex matching against string: %accName%;%accHelp%;%accValue%;%accDescription%; %accDefaultAction%
;----------------------------------------------------------------------------------------------------------------------

本文发布于:2023-05-13 10:59:56,感谢您对本站的认可!

本文链接:https://patent.en369.cn/patent/4/97942.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:访问   操作   函数   程序   脚本   受限   例如
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 369专利查询检索平台 豫ICP备2021025688号-20 网站地图