开发者

Use AutoIt with java applications

开发者 https://www.devze.com 2023-02-16 18:08 出处:网络
AutoIt seems to stop working when focus is given to a java application. For this code: MouseMove(61, 121, 10);

AutoIt seems to stop working when focus is given to a java application.

For this code:

MouseMove(61, 121, 10);
WinAct开发者_StackOverflow社区ivate("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?


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?


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!


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消