Hello,

I'm writing automation scripts in VBA and VBS to use IE6 to retrieve
data from web sites.

I create an instance of IE (or sometimes connect to one instance
already open) and send it commands to navigate to URLs, and retrieve
the data contained in tables etc.

My questions (so far) are:

1) How do I avoid the loading of images? (Ideally the user should be
able to browse normally while my script runs, this means: if the
solutions involves the "display images" option, can it be set to OFF
in one instance without affecting other IE instances?)

2) How to disable the clicking that happens when IE starts navigation?
(again, disabling it in Control Panel shouldn't affect other
instances, ideally)

Thanks in advance
Chris

Re: Avoid loading images - Avoid sounds by McKirahan

McKirahan
Mon Sep 03 19:23:11 PDT 2007

"Chris L." <diversos@uol.com.ar> wrote in message
news:1188852551.900837.236710@d55g2000hsg.googlegroups.com...
> Hello,
>
> I'm writing automation scripts in VBA and VBS to use IE6 to retrieve
> data from web sites.
>
> I create an instance of IE (or sometimes connect to one instance
> already open) and send it commands to navigate to URLs, and retrieve
> the data contained in tables etc.
>
> My questions (so far) are:
>
> 1) How do I avoid the loading of images? (Ideally the user should be
> able to browse normally while my script runs, this means: if the
> solutions involves the "display images" option, can it be set to OFF
> in one instance without affecting other IE instances?)
>
> 2) How to disable the clicking that happens when IE starts navigation?
> (again, disabling it in Control Panel shouldn't affect other
> instances, ideally)


"... automation scripts in ... VBS ... to retrieve data from web sites."

Have you consider just fetching the page's source without using a
browser? Consider the following script which saves the source of
any URL into a file called "Fetched.vbs" in the current directory.

Option Explicit
'*
Const cVBS = "Fetched.vbs"
Const cTXT = "Fetched.txt"
Const cURL = "http://www.google.com"
'*
Dim strDIR
strDIR = WScript.ScriptFullName
strDIR = Left(strDIR,InStrRev(strDIR,"\"))
Dim strOUT
strOUT = strDIR & cTXT
Dim strURL
strURL = Trim(InputBox("Enter a URL.",cVBS,cURL))
If strURL = "" Then WScript.Quit
MsgBox Fetch(strURL,strOUT),vbInformation,cVBS

Function Fetch(sURL,sOUT)
On Error Resume Next
Err.Clear
'*
Const adSaveCreateOverWrite = 2
Const adTypeBinary = 1
Const adTypeText = 2
'*
Dim objXML
'Set objXML = CreateObject("MSXML2.ServerXMLHTTP.3.0")
Set objXML = CreateObject("Microsoft.XMLHTTP")
objXML.Open "GET", sURL, False
objXML.Send
Dim strXML
strXML = objXML.ResponseBody
If Err.Number <> 0 Or objXML.Status <> 200 Then
Fetch = False
Exit Function
End If
Set objXML = Nothing
'*
Dim objADO
Set objADO = CreateObject("ADODB.Stream")
objADO.Type = adTypeBinary
objADO.Open
objADO.Write strXML
objADO.SaveToFile sOUT, adSaveCreateOverWrite
Set objADO = Nothing
Fetch = Err.Number = 0
End Function




Re: Avoid loading images - Avoid sounds by Paul

Paul
Mon Sep 03 20:17:32 PDT 2007


"McKirahan" <News@McKirahan.com> wrote in message
news:xpadnXXKrrISXEHbnZ2dnUVZ_saknZ2d@comcast.com...
> "Chris L." <diversos@uol.com.ar> wrote in message
> news:1188852551.900837.236710@d55g2000hsg.googlegroups.com...
>> Hello,
>>
>> I'm writing automation scripts in VBA and VBS to use IE6 to retrieve
>> data from web sites.
>>
>> I create an instance of IE (or sometimes connect to one instance
>> already open) and send it commands to navigate to URLs, and retrieve
>> the data contained in tables etc.
>>
>> My questions (so far) are:
>>
>> 1) How do I avoid the loading of images? (Ideally the user should be
>> able to browse normally while my script runs, this means: if the
>> solutions involves the "display images" option, can it be set to OFF
>> in one instance without affecting other IE instances?)
>>
>> 2) How to disable the clicking that happens when IE starts navigation?
>> (again, disabling it in Control Panel shouldn't affect other
>> instances, ideally)
>
>
> "... automation scripts in ... VBS ... to retrieve data from web sites."
>
> Have you consider just fetching the page's source without using a
> browser? Consider the following script which saves the source of
> any URL into a file called "Fetched.vbs" in the current directory.
>
> Option Explicit
> '*
> Const cVBS = "Fetched.vbs"
> Const cTXT = "Fetched.txt"
> Const cURL = "http://www.google.com"
> '*
> Dim strDIR
> strDIR = WScript.ScriptFullName
> strDIR = Left(strDIR,InStrRev(strDIR,"\"))
> Dim strOUT
> strOUT = strDIR & cTXT
> Dim strURL
> strURL = Trim(InputBox("Enter a URL.",cVBS,cURL))
> If strURL = "" Then WScript.Quit
> MsgBox Fetch(strURL,strOUT),vbInformation,cVBS
>
> Function Fetch(sURL,sOUT)
> On Error Resume Next
> Err.Clear
> '*
> Const adSaveCreateOverWrite = 2
> Const adTypeBinary = 1
> Const adTypeText = 2
> '*
> Dim objXML
> 'Set objXML = CreateObject("MSXML2.ServerXMLHTTP.3.0")
> Set objXML = CreateObject("Microsoft.XMLHTTP")
> objXML.Open "GET", sURL, False
> objXML.Send
> Dim strXML
> strXML = objXML.ResponseBody
> If Err.Number <> 0 Or objXML.Status <> 200 Then
> Fetch = False
> Exit Function
> End If
> Set objXML = Nothing
> '*
> Dim objADO
> Set objADO = CreateObject("ADODB.Stream")
> objADO.Type = adTypeBinary
> objADO.Open
> objADO.Write strXML
> objADO.SaveToFile sOUT, adSaveCreateOverWrite
> Set objADO = Nothing
> Fetch = Err.Number = 0
> End Function

I agree with you fully when you know that the data you are looking for comes
directly from that URL. It bypasses the downloading of unnecessary stuff
like pictures, popup, etc. VBScript can quickly and easily extract the info
from the file you save from the stream. There are cases where you are
redirected to some other URL which actually contains the info of interest.
I haven't found a reliable way to handle this with without letting the
browser do the redirection.

-



Re: Avoid loading images - Avoid sounds by McKirahan

McKirahan
Mon Sep 03 21:03:45 PDT 2007

"Paul Randall" <paulr901@cableone.net> wrote in message
news:eWkyAIq7HHA.3900@TK2MSFTNGP02.phx.gbl...
>
> I agree with you fully when you know that the data you are looking for
comes
> directly from that URL. It bypasses the downloading of unnecessary stuff
> like pictures, popup, etc. VBScript can quickly and easily extract the
info
> from the file you save from the stream. There are cases where you are
> redirected to some other URL which actually contains the info of interest.
> I haven't found a reliable way to handle this with without letting the
> browser do the redirection.

One approach might be to use an iframe within an HTA to naviagte pages
then, for pages of interest, click on a button to invoke the fetch script.



Re: Avoid loading images - Avoid sounds by Paul

Paul
Tue Sep 04 11:09:09 PDT 2007

Thanks. I will have to give that a try.
Currently, I have some logic that tries to decide when the final page has
loaded and then gathers the data.

-Paul Randall

"McKirahan" <News@McKirahan.com> wrote in message
news:pt6dnTjaUsG8REHbnZ2dnUVZ_hynnZ2d@comcast.com...
> "Paul Randall" <paulr901@cableone.net> wrote in message
> news:eWkyAIq7HHA.3900@TK2MSFTNGP02.phx.gbl...
>>
>> I agree with you fully when you know that the data you are looking for
> comes
>> directly from that URL. It bypasses the downloading of unnecessary stuff
>> like pictures, popup, etc. VBScript can quickly and easily extract the
> info
>> from the file you save from the stream. There are cases where you are
>> redirected to some other URL which actually contains the info of
>> interest.
>> I haven't found a reliable way to handle this with without letting the
>> browser do the redirection.
>
> One approach might be to use an iframe within an HTA to naviagte pages
> then, for pages of interest, click on a button to invoke the fetch script.
>
>



Re: Avoid loading images - Avoid sounds by Chris

Chris
Tue Sep 04 12:54:46 PDT 2007

On 3 sep, 23:26, "McKirahan" <N...@McKirahan.com> wrote:
> "Chris L." <diver...@uol.com.ar> wrote in message
>
> news:1188852551.900837.236710@d55g2000hsg.googlegroups.com...
>
>
>
>
>
> > Hello,
>
> > I'm writing automation scripts in VBA and VBS to use IE6 to retrieve
> > data from web sites.
>
> > I create an instance of IE (or sometimes connect to one instance
> > already open) and send it commands to navigate to URLs, and retrieve
> > the data contained in tables etc.
>
> > My questions (so far) are:
>
> > 1) How do I avoid the loading of images? (Ideally the user should be
> > able to browse normally while my script runs, this means: if the
> > solutions involves the "display images" option, can it be set to OFF
> > in one instance without affecting other IE instances?)
>
> > 2) How to disable the clicking that happens when IE starts navigation?
> > (again, disabling it in Control Panel shouldn't affect other
> > instances, ideally)
>
> "... automation scripts in ... VBS ... to retrieve data from web sites."
>
> Have you consider just fetching the page's source without using a
> browser? Consider the following script which saves the source of
> any URL into a file called "Fetched.vbs" in the current directory.
>
> Option Explicit
> '*
> Const cVBS = "Fetched.vbs"
> Const cTXT = "Fetched.txt"
> Const cURL = "http://www.google.com"
> '*
> Dim strDIR
> strDIR = WScript.ScriptFullName
> strDIR = Left(strDIR,InStrRev(strDIR,"\"))
> Dim strOUT
> strOUT = strDIR & cTXT
> Dim strURL
> strURL = Trim(InputBox("Enter a URL.",cVBS,cURL))
> If strURL = "" Then WScript.Quit
> MsgBox Fetch(strURL,strOUT),vbInformation,cVBS
>
> Function Fetch(sURL,sOUT)
> On Error Resume Next
> Err.Clear
> '*
> Const adSaveCreateOverWrite = 2
> Const adTypeBinary = 1
> Const adTypeText = 2
> '*
> Dim objXML
> 'Set objXML = CreateObject("MSXML2.ServerXMLHTTP.3.0")
> Set objXML = CreateObject("Microsoft.XMLHTTP")
> objXML.Open "GET", sURL, False
> objXML.Send
> Dim strXML
> strXML = objXML.ResponseBody
> If Err.Number <> 0 Or objXML.Status <> 200 Then
> Fetch = False
> Exit Function
> End If
> Set objXML = Nothing
> '*
> Dim objADO
> Set objADO = CreateObject("ADODB.Stream")
> objADO.Type = adTypeBinary
> objADO.Open
> objADO.Write strXML
> objADO.SaveToFile sOUT, adSaveCreateOverWrite
> Set objADO = Nothing
> Fetch = Err.Number = 0
> End Function- Ocultar texto de la cita -
>
> - Mostrar texto de la cita -

Hello, thanks for the useful script; it will come in handy for another
project I have.

But, as my first question is concerned, I need the browser interaction
because I have to fill in fields, position comboboxes, check some
boxes, then press a button, wait for search results to display, then
store the resulting data, all automatically.

Can I assume there is no way to keep the images from loading? (I have
searched the NGs to no avail)

Regards
Chris



Re: Avoid loading images - Avoid sounds by mr_unreliable

mr_unreliable
Wed Sep 05 09:17:40 PDT 2007

Chris L. wrote:
> Can I assume there is no way to keep the images from loading? (I have
> searched the NGs to no avail)
>
Chris, as you probably know, back in the days of dial-up,
most browsers allowed you to turn off images, so that the
remaining page content (text) could load faster.

As far as I can tell, Firefox and Internet Explorer have
dropped this feature. But google turns up the fact that
the Mozilla Navigator does still have it. Their "Image
Manager" allows for screening out offensive images
(although some may not consider nude women to be offensive),
or screen out _ALL_ images.

http://www.mozilla.org/products/mozilla1.x/

Offhand, I can't think of any clever way to screen out music.
However, there is still "Brute Force". The browsers themselves
don't play music, it requires an actX control to do that.
Either WMP, or one of the others will be used -- and it is the
webpage that calls for one specific control or another to play
the music. If you disable wmp (or whatever) when displaying
the page you wish to work with, then that will "stop-the-music".

You may disable wmp (or other music player) by UN-registering
the control. Most browsers, if they can't instantiate the
control requested, will go along their merry way anyway.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)