Sign in to follow this  
Followers 0
bigdog05

Inactive Java Swing Application

8 posts in this topic

#1 ·  Posted (edited)

My problem is as such:

I have an app that is written completely in Java using Swing. By now I have figured out that because Swing doesn't use standard Windows widgets and instead paints its own onto the canvas I can't directly manipulate Swing controls using the ControlSend(), thus not being able to identify a ControlID/Classname etc using the AutoIt Window Info Tool. I have now resorted to simply sending TABS to select the appropriate controls (input box, drop down menu) in the App to position focus on the desired control and then sending keystrokes using the Send(), which works fine as long as the Window is active. My question is can I continue to follow this same TAB approach with the Window inactive? And if so, how?. e.g. using something like ControlSend(title,"","","some text").

Thanks in advance.

bigdog05

Edited by bigdog05

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I am not that familiar with autoit, but why don't you just try ControlSend and see what it does.

Another option you might want to consider is that i believe java can accept inputStreams from different from various methods such as tcp so maybe you can send data to your application via autoit's tcp udf. And then have the application respond. I would suggest opening another thread for this. I mean thread as in a multithreaded application hehe not another forum thread.

Edited by ethnarch

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I am not that familiar with autoit, but why don't you just try ControlSend and see what it does.

Another option you might want to consider is that i believe java can accept inputStreams from different from various methods such as tcp so maybe you can send data to your application via autoit's tcp udf. And then have the application respond. I would suggest opening another thread for this. I mean thread as in a multithreaded application hehe not another forum thread.

I have tried the ControlSend method I mentioned in my previous post with no success. Just to clairify the Java App is not my own app which I have the source code for, it is just an App installed on my machine, so as of now I'm just treating it as a blackbox. So the only thing I could make multithreaded would be another program I write to send tcp messages from.

Edited by bigdog05

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I unfortunately do not know the answer but before you chase your tail around autoit doesn't do multithread. I believe its on the not to do list. That being said, post a screenshot of the java window, let people know the name of the app, and they might be able to give you a better answer. I don't know (but would assume) that you could use WinActivate though to give focus to the application and continue to use keystrokes like you have been.

Sorry I couldn't be of more help!

EDIT: if your interested heres the things not on the to do list...

http://www.autoitscript.com/forum/index.php?showtopic=33373

Edited by someone

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

Unfortunately, I can not post a screenshot of the App nor is it an App anybody would be familiar with. The App is a custom govt. App written as a Java Swing Application using your customary JFrame. Currently, I'm using WinActivate to force the window to activate the problem arises when the user decides to click on a different screen in the middle of sending keystrokes, thus causing the keystrokes to be lost, this is the reason I would like to nullify the user intervention causing an error.

Share this post


Link to post
Share on other sites

you can use autoit to block all user input use this

BlockInput ( flag )

I unfortunately do not know the answer but before you chase your tail around autoit doesn't do multithread.

for the record i didn't say to use multithreading in autoit i said in java! I wouldn't give someone bad information like that

Share this post


Link to post
Share on other sites

If you do block input just be very sure that one way or another you reverse the changes otherwise it will render your computer useless. Make sure there is some kind of timeout or error checking to prevent this.

Share this post


Link to post
Share on other sites

Thanks for the help guys I guess at this point the best thing I could do is disallow user input during the sending of keystrokes to my App, although if anyone else knows of a way to send keystrokes to an inactive Java Swing window without specifying a control let me know, it would be highly appreciated.

Bigdog05

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