【发布时间】:2022-05-07 03:30:37
【问题描述】:
我在工作中使用 Java 应用程序。我需要将点击发送到按钮并填写文本框。我希望这些动作在后台发生。窗口的ahk_class 是 SunAwtFrame,没有任何控件暴露给 WindowSpy。
我使用 JavaFerret 确定我要按下的第一个按钮有一个 AccessibleAction
Version Information:
Java virtual machine version: 1.7.0_25
Access Bridge Java class version: 1.7.0_25
Access Bridge Java DLL version: AccessBridge 2.0.2
Access Bridge Windows DLL version: AccessBridge 2.0.2
AccessibleContext information:
Name: New Call
Description: Place a new call
Role: push button
Role in en_US locale: push button
States: enabled,focusable,visible,showing,opaque
States in en_US locale: enabled,focusable,visible,showing,opaque
Index in parent: 1
Children count: 0
Bounding rectangle: [288, 317, 385, 376]
Top-level window name: Phone Assistant:
Top-level window role: frame
Parent name:
Parent role: panel
Visible descendents count: 0
AccessibleIcons info:
Number of icons: 1
Icon 0 description: jar:http://proxy.m5net.com/vox/pa/receptioncenter.jar!/resources/phone.png
Icon 0 height: 26
Icon 0 width: 27
AccessibleActions info:
Number of actions: 1
Action 0 name: click
Accessible Value information:
Current Value: 0
Maximum Value: 1
Minimum Value: 0
辅助功能文档告诉我应该告诉对象执行该操作,但我不知道如何执行此操作。
最好用AutoHotkey,怎么做?
【问题讨论】:
-
我也想将 AutoHotKey 与 java 应用程序一起使用。你有没有找到解决这个问题的方法?
-
不幸的是我没有。我最终使用了一个 hacky 解决方案,AHK 脚本将向前拉 Java 窗口,使用相对坐标与输入和按钮进行交互,然后再次将 Java 窗口推回。
-
如果您需要检查 Java 应用是否已完成加载,您可以尝试checking the mouse status 或color of a specific pixel on the page。
-
您可以使用 Java Access Bridge API。 (见How to send to unseen controls in a Java app)
-
您可以将其设为全屏,然后与特定坐标进行交互。
标签: java automation accessibility autohotkey