Sign in to follow this  
Followers 0
WauloK

Scripting to a Java applicaton

5 posts in this topic

Howdy!

I've been reading through the forums and I can see where it's impossible to get a control in a Java app because, basically, they have none.

However, I see there are functions to send commands/actions to controls on an inactive window (the app I'm writing needs to run when the PC is locked), but there seems to be no way to send a command/keypress to an inactive window. Have I missed somewhere? The Java app I am talking about only needs the F2 key pressed from time to time to stop it logging out due to inactivity. If I could send an F2 keypress to the whole inactive window, I believe it would solve my problem.

Any takers? Or perhaps it could be something added to a future version of AutoIT if it doesn't already exist :)

Share this post


Link to post
Share on other sites



ControlSend?

Alternatively, use _SendMessage with $WM_KEYDOWN and $WM_KEYUP with a VK_KEYCODE of $VK_F2

WBD

Share this post


Link to post
Share on other sites

ControlSend sounded good, but there's no Controls in a Java application, as stated above so I don't think this would work? :)

Will look at _SendMessage now. Thanks.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hmm...

This sort of seems to work MOST of the time.

It only works on my PC if the window is not Minimized. It seems to work if the one I want is not the Active window. It even seems to work if the PC is locked.

However, I send the same script to friends, compiled or not, and it doesn't work unless the Window I want is the Active window. I have an AutoIT friend and he compiles it and it doesn't work for him.

Curiouser and Curiouser.

$hwnd = WinGetHandle( $SrvCtrTitle )

ControlSend($hwnd, '', '', '{F2}')

Edited by WauloK

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0