Sign in to follow this  
Followers 0
Skepsis

Autoit hangs if window focus changed

4 posts in this topic

OK, I have only started with Autoit recently but have been using other GUI automation packages for years (QTP, TestComplete, Rational Robot etc)

What happens is that if another window gains focus and is partially over the window Autoit is trying to use then Autoit hang just after either show(restore?), set on top or activate. I don't know which it is yet but until the wanted window is clicked on / given focus again or using the ALT Tab combination, even though the AutoIt has made it the top window again, then the Autoit script does not continue.

The first lines of the code, find the window, shows it, sets it on top, and activate it reporting at every step with output to a file what has happened.

So the question, sorry for the delay?

Why does Autoit hang / pause when another window has focus even when one of the lines of code pushes it back to the top?

Thank you very much for your time.

Ade

Share this post


Link to post
Share on other sites



The short answer is: It doesn't.

You will need to post an example of the code that 'hangs' to figure out what you are seeing. But AutoIt scripts don't do that unless you coded them to (like with WinWaitActive() in a loop).

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

You probably have something like WindowWaitActive() or something.

Add to the top of the script the following line:

Opt("TrayIconDebug", 1) ;0=no info, 1=debug line info

This will allow you to see where it hangs.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Thanks forthe replies.

Yep, you are all right I have win wait active in the section that does this lot:

if $title == $foundWindow then

$Continue = "True"

WinSetState($foundWindow , "", @SW_SHOW)

WinSetOnTop($foundWindow , "", 1)

winwaitactive($foundWindow )

endIf

So are you saying that winwaitActive is not the correct answer here? I should be using winActivate FIRST?

I assumed that because the code was getting the window to the top then the window wold be activated as well...

Thanks again I will code with a passion and see how it goes :)

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