文章目录

  • 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. AutoHotkey MACC/acc.ahk简要使用引导

配置过程

  1. 下载github的代码 accV2下载地址
  2. 解压缩得到下面的
  3. 将AccV2.ahk 复制到和自己的脚本同个文件夹下.

也有介绍说把这个库直接放在ahk软件的库里面的. 我暂时没有采用这种方法.


5. 在自己脚本的开头引入上面的脚本,这样就可以用acc的函数了. 函数介绍看下面,或者打开 accV2.ahk脚本,在开头有英文介绍.

资源

  • accV2下载地址

  • jeeswg教程(英文)
    这个下面有很多这个作者的案例脚本,自己可以查阅

函数列表

;----------------------------------------------------------------------------------------------------------------------
; 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 functionality e.g.
;         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,accParent,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_UnhookWinEvent,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 servers 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 get_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_accSelection.
;  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 such as AccessibleChildren, get_accChild, get_accParent, and IEnumVARIANT. Traverses to another user interface element within a container and retrieves 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_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 IAccessible 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, if 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%
;----------------------------------------------------------------------------------------------------------------------

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

  1. openGL库的简单配置

    主要是针对openGL的一些初步的学习,因为openCV主要是处理图像视频,是从现有的得到数据,而openGL好像是从数据进行绘图,学习一下.在<计算机图形学编程>一书中,它把图形编程定性 ...

  2. AutoHotKey进阶 --- 单击网页中的按钮(Acc库)

    文章目录 AutoHotKey进阶 --- 单击网页窗口中按钮(Acc库) 引言 演示demo 代码实现 基本环境 代码 AutoHotKey进阶 - 单击网页窗口中按钮(Acc库) 引言 适合人群 ...

  3. AutoHotKey进阶---acc查看窗口所有对象的ID号

    文章目录 AutoHotKey进阶---acc查看窗口所有对象的信息(包括ID) 引言 ahkspy 工具方法 参考(旧版本) 案例演示demo 代码实现 AutoHotKey进阶-acc查看窗口所有 ...

  4. php mockery,mockery-master用于测试的模拟对象PHP库

    mockery-master用于测试的模拟对象PHP库 use Mockery\ExpectationInterface; use Mockery\Generator\CachingGenerator ...

  5. 不是python中用于开发用户界面的第三方库-Python三方库:wxPython(GUI图形用户界面)...

    wxPython是一套基于Python的第三方GUI插件,可用Python制作丰富的图形化界面程序. 安装:pip install wxPython 或者 网站下载安装https://pypi.org ...

  6. Python 模拟浏览器访问网页,Selenium库的详细使用

    (一)Selenium基础 入门教程:Selenium官网教程 1.Selenium简介 Selenium是一个用于测试网站的自动化测试工具,支持各种浏览器包括Chrome.Firefox.Safar ...

  7. 2021年用于图像处理的Python顶级库

    点击上方"3D视觉工坊",选择"星标" 干货第一时间送达 介绍 正如IDC所指出的,数字信息将飙升至175 ZB,而这些信息中的巨大一部分是图片.数据科学家需要 ...

  8. [Qt] 利用QtWebKit完成JavaScript访问C++对象

    http://blog.csdn.net/longsir_area/article/details/42965565 一. 介绍 在浏览器扩展或者WebApp的项目经常用的脚本语言JavaScript ...

  9. 选择嵌套_如何优雅地在JavaScript中访问嵌套对象

    在JavaScript中访问嵌套对象 以超酷的方式安全地访问JavaScript中的嵌套对象 JavaScript是惊人的,我们都知道.但是JavaScript中的一些东西真的很奇怪,它们让我们大开眼 ...

最新文章

  1. flask中的flask_uploads上传文件
  2. 又踩到Dubbo的坑,但是这次我笑不出来
  3. 专家谈计算机体系架构研究获“图灵奖”
  4. JS获取当前对象大小以及屏幕分辨率等...
  5. python2.7 + selenium3.4.3浏览器的选择
  6. element ui 下拉列表验证无效的问题(通俗易懂)-实例讲解
  7. spring MVC(2)--注解Hello World
  8. 计算机编程的 20 年变迁!
  9. SpringCloud系列五:Ribbon 负载均衡(Ribbon 基本使用、Ribbon 负载均衡、自定义 Ribbon 配置、禁用 Eureka 实现 Ribbon 调用)...
  10. django+echarts+ajax异步+显示优化--基本例子
  11. Rad Controls_Q2_2006 注册机
  12. 【BZOJ】3963: [WF2011]MachineWorks
  13. JDK 8 foreach的用法
  14. html5车牌效果,车牌自编效果预览软件【京牌】
  15. 0204UNIFORM SIZE=10M?index?insert分裂
  16. 快速集成华为AGC-AppLinking服务-Cocos平台
  17. 惜败!国足2-3不敌沙特,输球原因有哪些?
  18. 列举html5格式,前端HTML5基本格式【前端技术文章】
  19. 在android studio中启动模拟器的时候报错...keeps shopping
  20. Vue3.0的新特性(8)Suspense

热门文章

  1. ESP32 (ESP-Moonlight) 系列笔记
  2. vue 上传shp和zip格式转geo
  3. DHC插件的下载与安装
  4. oracle连接种类,oracle连接种类整理
  5. 聊一聊在软件测试过程中如何保障产品质量
  6. [Unity 学习] - 进阶篇 - Mesh基础系列1:生成网格
  7. shell——压缩解压缩
  8. RubyMine 4 注册 序列号
  9. 美团组件化事件总线方案改进:ModularEventBus
  10. C++ Void 指针 教程