Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - How to click on arbitrary highlighted item

Reply
 
Old 01-16-2009   #1 (permalink)
Leslie Houk


 
 

How to click on arbitrary highlighted item

Our company recently upgraded to IE7, and at the same time locked down
our IE system settings with group policies, so that we can't click on
Tools -> Internet Options and change anything. Unfortunately, the
upgrade broke the script I was using to access a remote site and
download a file automatically. Now, when I try to start the download,
I get the message, "To help protect your security, Internet Explorer
blocked this site from downloading files to your computer. Click here
for options..."

Since I can't change the IE settings, I decided to kludge my script to
click on the warning and tell it to go ahead with the download.
However, I can't figure out what to tell my script to click on. Since
the warning is generated by IE rather than the webpage, I don't know
what to use the Click method on. I did manage to use SendKeys to send
enough Tab characters to highlight the warning, but how do I use the
Click method to click on it once it's highlighted?

Thanks in advance to all who respond.
Leslie

My System SpecsSystem Spec
Old 01-16-2009   #2 (permalink)
Tom Lavedas


 
 

Re: How to click on arbitrary highlighted item

On Jan 16, 12:34*pm, Leslie Houk <lh...@xxxxxx> wrote:
Quote:

> Our company recently upgraded to IE7, and at the same time locked down
> our IE system settings with group policies, so that we can't click on
> Tools -> Internet Options and change anything. *Unfortunately, the
> upgrade broke the script I was using to access a remote site and
> download a file automatically. *Now, when I try to start the download,
> I get the message, "To help protect your security, Internet Explorer
> blocked this site from downloading files to your computer. *Click here
> for options..."
>
> Since I can't change the IE settings, I decided to kludge my script to
> click on the warning and tell it to go ahead with the download.
> However, I can't figure out what to tell my script to click on. *Since
> the warning is generated by IE rather than the webpage, I don't know
> what to use the Click method on. *I did manage to use SendKeys to send
> enough Tab characters to highlight the warning, but how do I use the
> Click method to click on it once it's highlighted?
>
> Thanks in advance to all who respond.
> Leslie
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
==========
My System SpecsSystem Spec
Old 01-16-2009   #3 (permalink)
Leslie Houk


 
 

Re: How to click on arbitrary highlighted item

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...@xxxxxx> wrote:
Quote:

>
> 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
> ==========
My System SpecsSystem Spec
Old 01-17-2009   #4 (permalink)
ekkehard.horner


 
 

Re: How to click on arbitrary highlighted item

Tom Lavedas schrieb:
Quote:

> On Jan 16, 12:34 pm, Leslie Houk <lh...@xxxxxx> wrote:
Quote:

>> Our company recently upgraded to IE7, and at the same time locked down
>> our IE system settings with group policies, so that we can't click on
>> Tools -> Internet Options and change anything. Unfortunately, the
>> upgrade broke the script I was using to access a remote site and
>> download a file automatically. Now, when I try to start the download,
>> I get the message, "To help protect your security, Internet Explorer
>> blocked this site from downloading files to your computer. Click here
>> for options..."
[...]
Quote:

> 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
As you specify "no async operation" here
Quote:

> oXML.send
> With CreateObject("ADODB.Stream")
> .type = adTypeBinary
> .mode = adModeReadWrite
> .open
> Do Until oXML.readyState = 4 : Wscript.Sleep 50 : loop
this loop shouldn't be necessary.
Quote:

> .write oXML.responseBody
> .savetofile FilePath, adSaveCreateOverwrite
> End With
> End Sub
[...]
My System SpecsSystem Spec
Old 01-17-2009   #5 (permalink)
Tom Lavedas


 
 

Re: How to click on arbitrary highlighted item

On Jan 16, 6:19*pm, Leslie Houk <lh...@xxxxxx> wrote:
Quote:

> 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
>
In that case, find a copy of AutoItX. It is a free ActiveX control
that instruments mouse clicks as well as sending keys and other
things.

Tom Lavedas
=========
My System SpecsSystem Spec
Old 01-18-2009   #6 (permalink)
Paul Randall


 
 

Re: How to click on arbitrary highlighted item


"Leslie Houk" <lhouk@xxxxxx> wrote in message
news:4a0b5e82-c973-45b8-8841-af1ff7531de6@xxxxxx
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...@xxxxxx> wrote:
Quote:

>
> 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
> ==========
I think that Tom's idea of using AutoItX is the way to go. AutoIt includes
a utility to identify each of the active areas on an open window, like your
popup. You script can do the things that activate the popup, tell AutoItX
to wait for the popup, and click the active spot of interest on the popup.
I've found AutoItX to be a resourse hog, so you might not want it waiting
24x7 for some window to pop up, but in you situation it would only be
waiting for the window for a short time.

http://www.autoitscript.com/autoit3/downloads.shtml

-Paul Randall


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Right Click New Item Vista General
Arbitrary changes Vista General
Right-click item in Start Menu = Explorer crash Vista General
Custom Right Click Menu Item Vista General
Right-click item on start menu = explorer crash Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46