Sign in to follow this  
Followers 0
r3dlined

ControlFocus hanging

5 posts in this topic

I see to have an issue that when ControlFocus attempts to focus on a control that is not on the active window, the script will hang. This would be the case where right before ControlFocus is called, a warning message may have popped up. I would assume that this would cause ControlFocus to return 0, but it does not. The script will just hang there until I manually interact on the screen and clear the window. Any advise to get around this?

Thanks,

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

We dont have your script so we cant see where did you make mistake

If you run

$a = ControlFocus("[CLASS:Notepad]", "", "Edit1")

msgbox(0,"",$a)

when your notepad win is open and you opened Save As.. (notepad is not on the active window)

It wil return 0, it will not hang.

Edit:

maby you have some WinWait* or similar command that put the script to hang?

So pls post script if you can so that we can see where the problem is located.

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

It actually looks like AutoIt is not accurately seeing the current active window (which is currently a warning message) by using WinGetTitle("[ACTIVE]"). The code right before the hang is:

LogTrace("Starting ClickFormButton")
    LogDebug("Before ClickForm first winchek")
    winCheck($title, $text)

    LogDebug("Before ControlFocus")
    LogDebug("Active window is '" & WinGetTitle("[ACTIVE]"))
    $success = ControlFocus($title, $text, "[TEXT:" & $buttonText & "]")
        LogDebug("Success of ControlFocus is: '" & $success & "'")

The last thing the log reads is " Active Window is 'Product Issue" which is actually false. The line "LogDebug("Success of ControlFocus is: '" & $success & "'")" is never called and the script is hanging at "$success = ControlFocus($title, $text, "[TEXT:" & $buttonText & "]")"

In the screenshot you can see that Product Issue is not the active window at all (maybe this is just a glitch in the software itself).

Posted Image

We dont have your script so we cant see where did you make mistake

If you run

$a = ControlFocus("[CLASS:Notepad]", "", "Edit1")

msgbox(0,"",$a)

when your notepad win is open and you opened Save As.. (notepad is not on the active window)

It wil return 0, it will not hang.

Edit:

maby you have some WinWait* or similar command that put the script to hang?

So pls post script if you can so that we can see where the problem is located.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I also want to note that as soon as I click on the screen the script stops hanging and my log picks up showing "Success of ControlFocus is: '1", but still sees Product Issue as the active window.

Edited by r3dlined

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

You did not post whall script

We dont know if the problem is in LogDebug func before it or after it becose we dont know whats in it, so you can try to eather post small script (shorter working version) that can reproduce hanging problem, or post whall script and if its too large praise the lord that someone can locate problem and help you.

You can try to use Opt("TrayIconDebug", 1) to detect whats happening (on what line the script to hang).

I dont know in what tupe of aplication is that program, i think that its something similar to access and it have probably is window in a window, so the second question heare is can you see ID: And TEXT: of that button with autoit window info tool at all?!!

And do window info detect Warning code win as a win?!!

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

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