Jump to content

Dialog Box Problem


DuncanM
 Share

Recommended Posts

I'm automating the configuration of a device via web browser, which has 2 frames (left and right). In the right frame, I wish to click on the "RESET" button. The following is the code I've implemented thus far:

$oIE = _IECreate ("https://192.168.2.1", 0, 1, 0)
$leftFrame = _IEFrameGetCollection($oIE, 1)
$rightFrame = _IEFrameGetCollection($oIE, 2)
$resetForm = _IEFormGetCollection($rightFrame, 0)
$resetButton = _IEFormElementGetObjByName($resetForm, "Reset")
$resetButton.click

When I execute this code, it does click the RESET button, which displays a Microsoft Internet Explorer dialog box asking "Are you sure you want to proceed?" (OK/CANCEL). The problem I'm having is that I am unable to send anything to this dialog box. I have tried ControlClick and Send, none of which work. In addition, _IEFormSubmit($resetForm, 0) does nothing. I'm so close to finishing this function..what am I doing wrong here?

Link to comment
Share on other sites

Ok, when I do Opt('TrayIconDebug', 1), I can see that it stops when at the WinWait('Microsoft Internet') line (i.e. when it waits for the "Microsoft Internet Explorer" dialog box to appear). This would prove that it's not recognizing this window, so I desperately need a way to send something to it!

Link to comment
Share on other sites

  • Moderators

Smoke - I'm not familiar with WinSearchChildren. How is this implemented? I can't seem to find any documentation on it. Thanks.

Look in Opt(). I told you to do this in the last thread that you brought up on the same subject.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Look in Opt(). I told you to do this in the last thread that you brought up on the same subject.

I added the following at the beginning of the script after Opt('TrayIconDebug', 1):

Opt('WinSearchChildren', 1)

I still can't seem to interact with the window (tried Send and ControlClick)..

Link to comment
Share on other sites

  • Moderators

I added the following at the beginning of the script after Opt('TrayIconDebug', 1):

Opt('WinSearchChildren', 1)

I still can't seem to interact with the window (tried Send and ControlClick)..

No site for us to test with, ... to be honest, I'm quite tired of the guessing game... GL Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

@DuncanM, I did not intend for this to be a ready-made answer to your problem. You will need to change/modify my example to fit your circumstance. Use the Au3 Window Info to learn more.

Thanks - I modified it using the following:

ControlClick("Microsoft Internet Explorer", "", "Button1")

Still nothing though.. :lmao:

Link to comment
Share on other sites

It should be obvious you will also need to change the WinExists function.

Correct - after I have it click on the RESET button and the dialog box appears, I now have the following code:

Sleep(1500)
If WinExists("Microsoft Internet Explorer", "Are you sure") Then
    ControlClick("Microsoft Internet Explorer", "Are you sure", "Button1")
EndIf

However, it still does not seem to be recognizing the window, even with WinChildExists set to 1. The debug says it's hung up on a Sleep line, but I can clearly see it's getting past that.. :lmao:

Link to comment
Share on other sites

Ok, I threw in some diagnostic MsgBox lines, and I've confirmed that it's definitely waiting for the main page to return before it continues the script (i.e. until the OK/CANCEL dialog box closes). When I issue the "click", is there a way to tell AutoIT not to wait till the page loads? Amazing how something that should be so simple gets so complex.

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