Use AutoIt with java applications

2019-06-03 09:46发布

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?

标签: java autoit
3条回答
够拽才男人
2楼-- · 2019-06-03 10:26

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!

查看更多
劳资没心,怎么记你
3楼-- · 2019-06-03 10:47

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?

查看更多
地球回转人心会变
4楼-- · 2019-06-03 10:49

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.

查看更多
登录 后发表回答