Sign in to follow this  
Followers 0
m1sh1

Automating Modal Internet Explorer Dialog Window

9 posts in this topic

Hi all, I am using AutoIt and IE UDF library to automate data entry into an ASPX application.

In the process of doing this one of the clicks opens a modal internet explorer dialog window for some data entry. However I find that the moment this window is opened the AutoIt script pauses itself and does not proceed any further until that window is manually filled and closed.

I was just wondering if anyone else has come across this behaviour and if they have been able to find a way to work around this issue.

Thanks for your help. Please let me know if the details are not clear.

Share this post


Link to post
Share on other sites



Hi all, I am using AutoIt and IE UDF library to automate data entry into an ASPX application.

In the process of doing this one of the clicks opens a modal internet explorer dialog window for some data entry. However I find that the moment this window is opened the AutoIt script pauses itself and does not proceed any further until that window is manually filled and closed.

I was just wondering if anyone else has come across this behaviour and if they have been able to find a way to work around this issue.

Thanks for your help. Please let me know if the details are not clear.

Yes, there is an example of dealing with this with the other examples in reply 3 of the IE.au3 post. It involves giving focus to the element you want to click on and then using Send or ControlSend to send an {Enter} which activates the button without stalling your script. You are then free to act on the modal dialog.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Yes, there is an example of dealing with this with the other examples in reply 3 of the IE.au3 post...

Dale

Thanks for that Dale that was very helpful. I have only just gotten a chance to try that out and I am able to get control back to the script. However I am still unable to gain control of the modal window that is opened. To provide you with a better illustraion of what is happening I have attached a screen shot of what I am doing.

Posted Image

I set the focus on the << Add Workforce and Career Level Criteria >> link and then Send("{ENTER}") as suggested by yourself. This opens up the window "Choose a combination . . ." which is a modal dialog window. The variable that I am using to keep track of the InternetExplorer.Application at this stage still points to the main window (that had the link in the first place) and not to the new window. I was wondering if you knew how I could get access to that modal dialog window so that I could mainpulate it using either the DOM or your IE.au3 UDF library.

Any help in this regards would be much appreciated. Thanks.

PS: Using _IE_Attach("Choose a combination") does not seem to return any object, but I will continue trying to work this one out. Also I am not sure if this helps but using WinExists("Choose a combination") returns true

Edited by m1sh1

Share this post


Link to post
Share on other sites

At this point the only thing we've worked out is to use autoit functions to manipulate the dialog instead of COM/DOM or IE.au3. Theoretically there are other options, but at this point it is the best I can offer. The modal dialog does not appear in the shell window collection, so the _IEAttach function does not see it. Use WinActivate and related functions to manipulate it.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

At this point the only thing we've worked out is to use autoit functions to manipulate the dialog instead of COM/DOM or IE.au3....

Dale

Ok thanks for that Dale.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Ok I am trying to use the WinActivate and Controls functions to try and get it working but having no luck. I was wondering if someone could possibly help.

The relevant code snippets are below.

Const $WF_WINDOW_TITLE = "Choose a combination"
Const $WF_COMBO_BOX = "Internet Explorer_TridentCmboBx3"

Func Test
    If (Not WinExists($WF_WINDOW_TITLE)) Then
        MsgBox(0, "", "Odd could not find choose combination window")
        Return
    EndIf

    Dim $setFocus = ControlFocus($WF_WINDOW_TITLE, "", $WF_COMBO_BOX)
    If $setFocus <> 1 Then
        MsgBox(0, "", "Nooooooooooo.......")
        Return
    EndIf
End Func

Now the first If statement makes sure that the window is visibile and accessible. Once that is confirmed I try and access the contol using the ClassNameNN method. However for some reason that fails. Does anyone any suggestions as to what may be going wrong here? The class name was obtained using the AutoIt Window Info utility and copy pasted.

Thanks.

PS: The web dialog page being edited looks like the image posted in Post 3.

Edited by m1sh1

Share this post


Link to post
Share on other sites

Ok I am trying to use the WinActivate and Controls functions to try and get it working but having no luck. I was wondering if someone could possibly help.

Oxin8 is correct in his observation... in addition, unfortunately, HTML controls are not standard windows controls, so you'll not be able to access them with ControlFocus and the like. You need to use keyboard SEND commands to interact with it -- sorry I didn't make that clear.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Ok that makes sense regarding not being able to get hold of the IE controls. Thanks for the help again guys.

Nav

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