Sign in to follow this  
Followers 0
DuncanM

Dialog Box Problem

23 posts in this topic

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?

Share this post


Link to post
Share on other sites



IIRC

Send("{TAB}") once or twice to get to the button you want

Send("{ENTER}")

Should work

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

IIRC

Send("{TAB}") once or twice to get to the button you want

Send("{ENTER}")

Should work

8)

Hi Valuater - I tried 1 tab, 2 tabs, no tabs..still no joy (dialog box remains)..

Share this post


Link to post
Share on other sites

Is there some way to tell the script to return immediately and not wait for the dialog to close? I'm doing it for $oIE, but I don't see any way to do so at the end of the script..

Share this post


Link to post
Share on other sites

Getting desperate for a solution..any ideas??

Share this post


Link to post
Share on other sites

Could Send("{TAB}") and Send("{ENTER}") be not working because AutoIT is waiting for the box to close? If so how can I disable this so I can interact with it?

Share this post


Link to post
Share on other sites

You may need an adlib statement:

If WinExists("Microsoft Internet Explorer", "sure?") Then
    ControlClick("Microsoft Internet Explorer", "sure?", "&Yes")
EndIf

Who else would I be?

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

Have you tried WinSearchChildren?


[center]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.[/center]

Share this post


Link to post
Share on other sites

Have you tried WinSearchChildren?

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

Share this post


Link to post
Share on other sites

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.

[center]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.[/center]

Share this post


Link to post
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.


Who else would I be?

Share this post


Link to post
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)..

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

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

[center]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.[/center]

Share this post


Link to post
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:

Share this post


Link to post
Share on other sites

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


Who else would I be?

Share this post


Link to post
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:

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Did't I just say the word adlib somewhere?


Who else would I be?

Share this post


Link to post
Share on other sites

Did't I just say the word adlib somewhere?

Hmm..how would you use adlib in this case? I looked at the help file, but didn't see any way to make it work in this scenario. Thanks again.

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