Sign in to follow this  
Followers 0
arpan

Not able to click the Save button when dialog is not having the focus

3 posts in this topic

#1 ·  Posted (edited)

Hi Folks,

I have written a script for file download for IE.

It works fine if the focus is on the download box. So explicitly I am trying to get the focus on the download window Sometimes it works , sometimes doesn't.

Earlier I tried doing by using the window names directly but it was not working so i have tried using windows but same results :>

One more scenario is : click on the download link in IE page, see the dialog box, open instance of chrome or opera browser. And run the script it fails. I am not sure why its happening.

Can any one tell what went wrong?

_Any help will be fine :unsure:_

I am attaching the script example here:

AutoItSetOption("WinTitleMatchMode","2") ; 
; wait Until dialog box appears and timemout of 10 seconds.
$wait = WinWait("Download","",30)
$title = WinGetTitle("Download") 
$handle = WinGetHandle($title)
WinActivate($handle)
If $wait =0 Then
Exit
EndIf 
If (StringCompare($CmdLine[2],"Save",0) = 0) Then
$wait = WinWaitActive($handle,"",10)
If $wait =0 Then
Exit
EndIf
ControlClick($handle,"","Button2")
$wait = WinWait("Save","",5)
If $wait =0 Then
Exit
EndIf
$title = WinGetTitle("Save")
$handle = WinGetHandle($title)
if($CmdLine[0] = 2) Then
$wait = WinWaitActive($handle,"",5)
If $wait =0 Then
Exit
EndIf
ControlClick($handle,"","Button2")
Else
;Set path and save file
$wait = WinWaitActive($handle,"",10)
If $wait =0 Then
Exit
EndIf
ControlSetText($handle,"","Edit1",$CmdLine[3])
ControlClick($handle,"","Button2")
Exit
EndIf
EndIf
Edited by arpan

Share this post


Link to post
Share on other sites



Did you try to get the url of download link, to use with inetget ?


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Did you try to get the url of download link, to use with inetget ?

@Wakillon.

Thanks but we are not supposed to give or know the URL of the download location.

We need to simulate the user behaviour. And wait for the popup to come and click.

Again some times we want to read the text of the dialog window (content on the dialog box)

I found a forum discussion on the same. Looks like its a limitation with RDP. Here is the link:

Edited by arpan

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