将 AutoIt 与 java 应用程序结合使用
当焦点转移到 java 应用程序时,AutoIt 似乎停止工作。
对于此代码:
MouseMove(61, 121, 10);
WinActivate("Main @ paperMoney [build 1800.20]");
MsgBox(0, "got it", "got it");
结果是 -->鼠标移动,java 应用程序获得焦点并出现消息
对于此代码:
WinActivate("Main @ paperMoney [build 1800.20]");
MouseMove(61, 121, 10);
MsgBox(0, "got it", "got it");
结果是 --> java 应用程序获得焦点,鼠标不动并且出现消息。
在 java 应用程序获得焦点后,我可以做些什么来使鼠标和键盘命令正常工作吗?
AutoIt seems to stop working when focus is given to a java application.
For this code:
MouseMove(61, 121, 10);
WinActivate("Main @ paperMoney [build 1800.20]");
MsgBox(0, "got it", "got it");
Results are --> Mouse moves, java application gets focus and message appears
For this code:
WinActivate("Main @ paperMoney [build 1800.20]");
MouseMove(61, 121, 10);
MsgBox(0, "got it", "got it");
Results are --> java application gets focus, mouse DOES NOT move and message appears.
Is there anything I can do to make the mouse and keyboard commands work after the java application has focus?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
考虑到纸币的作用,它可能是故意抵制自动化。特别是当窗口被激活时,它会挂钩低级鼠标事件并检查所有硬件鼠标移动与实际移动。使用它可以防止任何模拟的鼠标移动。您可以使用“发送”在窗口中键入按键吗?
Considering what paperMoney does, it is probably purposely resisting automation. Especially when the Window is activated, it will hook into low-level mouse events and check all hardware mouse movement with actual movement. Using that it will prevent any simulated mouse movement. Can you use Send to type keys in the Window?
我想做同样的事情。曼达纳尔可能是对的。我也尝试过 Autohotkey 但没有成功。也许 TOS 在其应用程序中深深地禁止了它。 :( 嘘!
编辑:
经过一番尝试,我发现 Mac OSX 上的 TOS 可以通过 Keyboard Maestro 进行脚本控制。这是一个丑陋的、被黑客攻击的解决方案,但它确实有效。如果您知道元素的 X、Y 位置,则可以编辑文本框并单击内容。
Keyboard Maestro 可以通过脚本(AppleScript、Python 等)运行,因此也许您可以构建一些精致的 rube goldberg。
交易愉快!
I looked to do the same thing. Mandanar is probably right. I also tried Autohotkey with no success. Perhaps TOS is prohibititng it deep in their application. :( Boo!
EDIT:
Some playing around I've discovered that TOS on Mac OSX can be controlled via scripting with Keyboard Maestro. It's a ugly, hacked solution, but it works. You can edit text boxes and click stuff if you know the X,Y position of elements.
Keyboard Maestro can be run via scrips (AppleScript, Python, etc.) so maybe you can build some elaborate rube goldberg.
Happy trading!
我的解决方案针对 AutoHotkey 进行了测试,但我相信这也适用于 AutoIt。我以管理员权限运行脚本,因为 TOS 是以管理员身份运行的,之后我的脚本工作正常。
My solution was tested for AutoHotkey, but I believe this should work for AutoIt also. I ran the script with administrator privileges since TOS is ran as an administrator and my scripts work fine after that.