Jump to content
Sign in to follow this  

Focus Problem in GUI

Recommended Posts


I'm an absolute beginner with AutoIT but I believe what I'm trying to do should be possible.

I'm trying to create a GUI app which behaves like a multiple clipboard. The app will send one of several text strings (I'm going to try mouse events later) to a window of the user's choosing (selected from a listbox populated by WinList).

Everything works up until I try to send it to the other window. My problem is I cannot get the target window to activate and keep the focus. I believe this may be happening because this is a GUI app.

The function ssend is where I'm trying to send the text string. $a is the full title of the desired window and $b is the string to send.

Func ssend($a,$:o

$handle = wingethandle($a)


$result = winactive($handle)

msgbox(4096,$result,"winactive " & $handle,20)



I tried to control the window by doing a winsetstate($handle,"",@SW_MAXIMIZE) but this maximizes my original app.

This is probably something simple but I can't figure it out.


Share this post

Link to post
Share on other sites

msgbox is a focus taker...

winactivate, then winwaitactive, then send


Thank you, this worked perfectly.

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