Jump to content

Difficulty interacting with a modal dialog box


NLee
 Share

Recommended Posts

Greetings,

I'm hoping this topic is appropriate to AutoIt, but it may be more of a VBA question.

I call a pre-compiled macro from within an Excel VBA script, which brings forth a modal dialog. I need to use AutoIt to navigate and operate that modal dialog, but I can't seem to get the modal dialog to appear and have AutoIt respond to it.

If I call the pre-compiled macro first, VBA halts until the modal dialog is dismissed, and the script doesn't get to the the calls to AutoItX3Lib.AutoItX3.

CODE
(VBA Code)

Dim objAutoIT As New AutoItX3Lib.AutoItX3 ' Define AutoIt Object

Application.Run "arma_vba.xla!armago" ' Run the macro

'STOPS HERE

With objAutoIT

.WinWait ("[web:reg] ARMA Add-In"), , 5 ' Wait for the modal dialog; time out after 5 seconds

.Send ("$H$13:$H$72")

If I call AutoItx3.WinWait first, VBA halts until the modal dialog appears, and it can't call the pre-compiled macro to make the dialog appear.

CODE
(VBA Code)

Dim objAutoIT As New AutoItX3Lib.AutoItX3 ' Define AutoIt Object

With objAutoIT

.WinWait ("[web:reg] ARMA Add-In"), , 5 ' Wait for the modal dialog; time out after 5 seconds

'STOPS HERE

Application.Run "arma_vba.xla!armago" ' Run the macro

.Send ("$H$13:$H$72")

It works ok if I use Excel VBA to open an external AutoIt script, because the script can run in parallel, and doesn't block Excel while it's waiting. I'm trying to do this all within my Excel VBA code, though, because I don't want to have several files needed for the script to run.

Any ideas?

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...