Sign in to follow this  
Followers 0
Blueman

Java Window Focus Loss

3 posts in this topic

#1 ·  Posted (edited)

Hi all,

For the last 2 weeks i'am working on a automated process for an Java Applet Window (Oracle).

Before i begin, the Java Applet Window is hidden (when it appear) and the commands are send With the ControlSend option. I am doing this because it is anoying when the window constantly pops-up while i am working on a document or something else. Thats why i hide the window and send key-strokes to it.


Everything is working like it should but here is my problem;

When the program is activated, the Java Applet Window gets focus and the key-strokes are working fine. The program will end with state=succesfull.
But when i am working on a document (like MS Word) i see that the focus is set to the Java Applet Window in the background, no problem here because one click and were back on track but somehow the Java Applet Window doesn't get the key-strokes even if the focus isn't in MS Word anymore,...

I thought maybe i can solve this with ControlFocus or WinActivate, but it doesn't work. The only thing that does work is just run the program and do Nothing,...

Local $hWnd =   WinWait("Oracle Applicaties", "", 120)
    WinSetState($hWnd, "", @SW_MAXIMIZE)
    WinSetState($hWnd, "", @SW_HIDE)




sleep(10000) 
WinSetOnTop($hWnd, "", 1)
WinActivate($hWnd)
ControlSend($hWnd, "", "", "{ENTER}")
sleep(2000)
WinActivate($hWnd)
ControlSend($hWnd, "", "", "{TAB}")
sleep(500)
WinActivate($hWnd)
ControlSend($hWnd, "", "", "{TAB}")
sleep(500)
WinActivate($hWnd)
ControlSend($hWnd, "", "", "{TAB}")
sleep(500)
WinActivate($hWnd)
ControlSend($hWnd, "", "", "{TAB}")
sleep(2000)
WinActivate($hWnd)
ControlSend($hWnd, "", "", "{ENTER}")
sleep(5000)
WinActivate($hWnd)
ControlClick($hWnd,"","","right",1,336,164)
sleep(2000)
WinActivate($hWnd)
ControlSend($hWnd, "", "", "{DOWN}")
sleep(2000)
WinActivate($hWnd)
ControlSend($hWnd, "", "", "l")

I Hope that someone can help me here, i also tried to use the CLASS name of the Window but even then it isn't working,..

 

Thanks guys!

 

EDIT: Figured out that the glitch is being created when i push the ControlClick option, somehow it doesn't get the focus i need to the window,.. Does anyone have a better way to do this?

Edited by Blueman

Share this post


Link to post
Share on other sites



I can suggest to try ControlCommand, maybe, not sure

Share this post


Link to post
Share on other sites

Hi all,

I fixed this problem with the; "BlockInput" UDF.
Now the keyboard is blocked when i send my actions tot the Java Applet Window :)

 

Thanks for the help!

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