Jump to content

Close Download Complete Daialog Issue


Recommended Posts

I have files that download from a web site and they work fine most of the time. Before I download a file now, I set the registry entry to enable the download complete dialog box so I can tell the download has completed. I started noticing the dialog not appearing sometimes and added the registry setting to force it before each download. The download is in a loop with a 120 second timeout so I can set the registry and retry the download. This works fine and I have a workaround.

I witnessed this today:

a) Downloading begins.

;) Download takes longer than normal.

c) The check box to close the dialog when download completes is checked (without intervention or coding on my part) and

the dialog closes.

d) No download complete dialog appears.

Since I have this coded in a timeout loop I reset the registry key and try again and it works. No problem. The workaround works.

This has prompted me to ask this question in the forums here:

What is checking the box automatically? AutoIt? Microsoft? the web site?

This is just a question I'm left scratching my head about. Any clues or a way to find out?

Link to comment
Share on other sites

ok, here's some code:

$stat=0
$FileName1 = @YEAR & @MON & @MDAY & "-" & @HOUR & @MIN & @SEC & "-FILE.CSV"
while $stat = 0
   Download1($FileName1)
   $stat=WinWaitActive("Download complete","",120)
  
   ;check file size
   $bytes=FileGetSize($FileName1)
  
   ;outlog("File Size = " & $bytes & " bytes")
  
   if $bytes < 128 Then
   $stat=0
   endif
     
   if $stat=0 then
   ;Failure to download in 120 seconds or file size problem
          ;set newfile name to try again
   $FileName1 = @YEAR & @MON & @MDAY & "-" & @HOUR & @MIN & @SEC & "-FILE.CSV"
   EndIf
wend

MouseClick("left",840,54)
Sleep(5000)
;Copy the File to the common name file ($FileName2)
ControlClick("Download complete","",2)
sleep(10000)
Exit
Func Download1($InFile)
;Click Download
$sStatus=SetRegEntry()
;outlog("Registry Setting = " & $sStatus)
MouseClick("left",497,56)
Sleep(10000)
WinWaitActive("File Download")
;Save
ControlClick("File Download","",4427)
;outlog("Save selected on File Download dialog")
Sleep(5000)
Send("{DEL}")
Sleep(200)
;Enter Filename
;outlog($InFile & " entered into file download dialog")
Send($InFile)
Send("{ENTER}")
sleep(5000)
;Close  
EndFunc

Func SetRegEntry()
$sStatus=RegWrite("HKEY_CURRENT_USERSoftwareMicrosoftInternet ExplorerMain","NotifyDownloadComplete","REG_SZ","yes")
MsgBox(0,"",$sStatus,1)
Return $sStatus
EndFunc
Link to comment
Share on other sites

The code above has the workaround applied. Sometimes the first time through the download complete dialog will not be shown. If the timeout (120 seconds) expires the registry key is written to and a retry will again display the download complete dalog. Just curious whos bug it is?

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