Jump to content

Script hangs after application pops up modal dialog


Recommended Posts

Hello,

I've been searching a bit the forums but I haven't seen any topic related.

I am trying to automate an application, and when I send a ControlCommand to change the value of a ComboBox the application pops up a modal dialog that I want to close. However after doing the ControlCommand the script seems to hang and start using around 10% of CPU.

The piece of code that is having problems is something like:

AutoItSetOption ("WinTitleMatchMode", 2)

...

    ControlCommand("program", "", 1000, "SetCurrentSelection", 1); this is executed
; AutoIt hangs here
    If WinWait("Error", "Error Message", 0.5) = 1 Then
      Send("{ENTER}")
    EndIf

I am on latest version (3.2.12.1)

I've discovered that if I manually close the dialog the script stays in memory and further executions work fine. However leaving a zombie process eating 10% of CPU is not an option. muttley

Link to comment
Share on other sites

WinWait's timeout will not work with a timeout of .5 seconds, you must use a whole number here.

Also maybe try using controlclick() or controlsend() instead of send()

The problem is that the script hangs before reaching the WinWait(), if I write there any code like MsgBox(0, "test", "test") nothing is displayed.

My guess is that the script never returns from the ControlCommand because the application spawns the modal dialog and the control and window it was addressing is not the current active one.

Link to comment
Share on other sites

I've made around it adding other entry point to my script and calling myself using that other entry point to close the new modal dialog (I do not want to have 2 scripts around).

It is dirty and obscure but it is the only way around it that I've been able to make work.

Or does anyone know if AutoIT has any multi-thread/multi-process support?

Thanks to all who replied.

Cheers

Link to comment
Share on other sites

  • 3 years later...

That's unfortunate. I came across the same issue in my application...

ControlCommand ( $sWebDomHandle, "", $otbActions, "SendCommandID", 36604 )

When the script performs the above action (a logout action), the window closes, and a new window opens (logout)...until I manually close the new window, the script stalls.

I saw other posts where a developer stated:

...oh, the $otbActions handle is for a class = ToolbarWindow32

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...