Jump to content
Sign in to follow this  
Hodahel

How to click "OK" on IE Popup?

Recommended Posts

Hodahel

Hey guys,

I'm trying to make a little script to make some changes on IE everything works will until this popup with OK and Cancel button.

I've already tried several codes like:

$wint = "Message from webpage"
$wintt = "Do you want to change current profile?"
while 1
if WinExists("$wint", "$wintt")  then Controlclick("$wint", "$wintt"), "Button1", "LEFT", 1)
sleep(500)
wend

 or

while 1
if WinExists("[CLASS:#32770]")  then Controlclick("[CLASS:#32770]", "Button1", "LEFT", 1)
sleep(500)
wend

or

If WinExists("Message from webpage") Then
    WinActivate("Message from webpage")
    Controlclick("[CLASS:#32770]", "OK", "Button1", "LEFT", 1, 44, 14)
EndIf

But still my script wont click the OK button..:(

 

When I tried to make all of the above script into EXE, then run it during the appearance of popup, the popup will close but when run inside the script with like runwait click_ok.exe, no effect..:(

 

Any idea to get me through it?

 

TIA

Share this post


Link to post
Share on other sites
DW1

-I assume quoting the variables is a typo in the post, and you didn't actually do that in the script ("$wint", etc)

-The first two that you posted will loop indefinitely as you are never exiting the infinite loop with ExitLoop

Share this post


Link to post
Share on other sites
Hodahel

Yes just a typo..here is the correct code I used..

$wint = "Message from webpage"
$wintt = "Do you want to change current profile?"
while 1 
if WinExists($wint, $wintt) then 
Controlclick($wint, $wintt, "Button1", "LEFT", 1) 
sleep(500) 
wend

Here is another code I already tried..

If WinExists("Message from webpage") Then
Controlclick("Message from webpage", "OK", "Button1", "LEFT", 1, 44, 14)
EndIf

Still I never make it to work..:(

Share this post


Link to post
Share on other sites
Chimp

also you say the popup has 2 buttons with OK and Cancel, in your script you use the string "Button1" in place of a controlID, what is "Button1"?

Edited by PincoPanco

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites
JLogan3o13

As there have already been several questions seeking clarification, why not post your script in its entirety so we don't have to guess? Help us help you :)

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Kidney

most of the time, that only pops up when there is a formsubmit. almost like a "Confirm" button.

i would check to see if the section of code on the site you r working with has the button type as submit.

if it does, use the formsubmit function and that "OK" button shouldnt appear.

Share this post


Link to post
Share on other sites
Hodahel

OK guys, I manage to find the solution... :thumbsup:

 

Now I'm stuck here..

StringRegExpReplace ( "text_to_test", "pattern_vary in characters", "this_is_to_replace")

pattern_vary in characters consist of 8 RANDOM character and ALWAYS start with four (4) ZERO, "0000" like 0000aex3, 0000yt67, etc..

How can I make it as valid pattern?

 

BR

Share this post


Link to post
Share on other sites
Chimp

where has your popup finished? :blink:


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites
Hodahel

Yes done with the POPUP..

with this code..

ControlSend("Message from webpage", "", "[CLASS:Button; INSTANCE:1]", "{enter}")

Thanks to this..

post-78616-0-03987400-1379688731_thumb.j

Edited by Hodahel

Share this post


Link to post
Share on other sites
Kidney

StringRegExpReplace ( "0000aex3", "0000wwww", "this_is_to_replace")

this will look for 4 leading zeros and then A-Z, a-z and 0-9 or _

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  

×