Re: How to click on arbitrary highlighted item

Tech-Archive recommends: Fix windows errors by optimizing your registry



Tom,

Thanks for the response. I did try sending the Enter key, but it
doesn't seem to have any effect. Sending the Esc key will close the
warning, so I'm guessing that it only responds to the Escape key and
to being clicked on, which opens a drop-down menu of actions.

The code to download the file is a good idea as well, but I didn't
mention that the website I'm hitting is the front end for a database.
I get the file I want to download by clicking on an Export button,
which generates the file on the fly. So, an actual file which I could
download doesn't exist.

But again, thanks for the ideas, and please let me know if you have
any others.
Leslie

On Jan 16, 2:27 pm, Tom Lavedas <tglba...@xxxxxxx> wrote:

You could just send an Enter key, something like  ...

  oWSHShell.Sendkeys "{Enter}"

However, why don't you just download the file directly using something
like ...

Sub DownBinFile(FilePath, sURL)
  const adTypeBinary = 1
  const adModeReadWrite = 3
  const adSaveCreateOverwrite = 2
 ' Create an xmlhttp object:
  set oXML = CreateObject("MSXML2.XMLHTTP")
  oXML.open "GET", sURL, False
  oXML.send
  With CreateObject("ADODB.Stream")
    .type = adTypeBinary
    .mode = adModeReadWrite
    .open
    Do Until oXML.readyState = 4 : Wscript.Sleep 50 : loop
    .write oXML.responseBody
    .savetofile FilePath, adSaveCreateOverwrite
  End With
End Sub

Tom Lavedas
==========

.


Quantcast