Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Browser Helper Object support Vbscript

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,66321
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Browser Helper Object support Vbscript
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Browser Helper Object support Vbscript - 11/12/2008 10:55:08 AM   
  dennisrobins

 

Posts: 5
Score: 0
Joined: 11/12/2008
Status: offline
Hello,

I just wanted anyone that is interested to checkout my latest blog posting. I released a Browser Helper Object that supports Vbscript and hope that some of you may find it useful. Here's the link...

http://frontierdg.blogspot.com/2008/11/super-flexible-browser-helper-object.html

I've tried to describe how it works in the posting. I appreciate any suggestions or reports of problems too :)

I'm interested if anyone would find this useful. Of course if free to use. Please respond back here at VBS forum and I'll respond ASAP.

Thank you. :)
 
 
Post #: 1
 
 RE: Browser Helper Object support Vbscript - 11/12/2008 12:23:43 PM   
  TNO


Posts: 1402
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
So quick and simple, what does this provide that cannot already be done by VBS? Do you have a working example besides navigating to google?

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to dennisrobins)
 
 
Post #: 2
 
 RE: Browser Helper Object support Vbscript - 11/13/2008 1:43:40 AM   
  dennisrobins

 

Posts: 5
Score: 0
Joined: 11/12/2008
Status: offline
Hello TNO.

It is the same, because you're executing VBS just as you would a stand-alone script.

The benefit of BHO.VBS is that you can tie your code to the Internet Explorer DocumentComplete event. So your script runs whenever the event fires.

I'll update the blog with some examples soon.

JIC, do you know of another way to attach to running instance of IE and the documentComplete event?  If so, let me know; maybe this isn't so useful.

quote:

ORIGINAL: TNO

So quick and simple, what does this provide that cannot already be done by VBS? Do you have a working example besides navigating to google?

(in reply to TNO)
 
 
Post #: 3
 
 RE: Browser Helper Object support Vbscript - 11/13/2008 2:14:13 AM   
  TNO


Posts: 1402
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
Do this:

Dim IE  : Set IE = CreateObject("InternetExplorer.Application","event_")

Then you will be able to capture events and use VBScript event  subs for any of the IE object's events:

http://msdn.microsoft.com/en-us/library/aa752084.aspx

But documentComplete is unreliable in a few cases (firing multiple times since the browser can progressivley load). Its safer to do this:

Do Until IE.readyState = 4: wscript.sleep 100: Loop

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to dennisrobins)
 
 
Post #: 4
 
 RE: Browser Helper Object support Vbscript - 11/13/2008 4:03:01 AM   
  dennisrobins

 

Posts: 5
Score: 0
Joined: 11/12/2008
Status: offline
You're right TNO. But, this is only true if you create the instance of Internet Explorer...

Set IE = CreateObject("InternetExplorer.Application")

I don't think that there is a way using just VBScript to attach to events in a already running instance of Internet Explorer that VBScript did not create. That's a feature that BHO.VBS provides. BHO.VBS enables vbscript (input.vbs) to fire whenever the documentComplete fires with any instance of IE. Yes, you are right that documentComplete will fire multiple times (iFrame, other HTML).

It looks like I better come up with some good examples to convince you or anyone else on the merits of BHO.VBS :)

Thanks for your comments.


quote:

ORIGINAL: TNO

Do this:

Dim IE  : Set IE = CreateObject("InternetExplorer.Application","event_")

Then you will be able to capture events and use VBScript event  subs for any of the IE object's events:

http://msdn.microsoft.com/en-us/library/aa752084.aspx

But documentComplete is unreliable in a few cases (firing multiple times since the browser can progressivley load). Its safer to do this:

Do Until IE.readyState = 4: wscript.sleep 100: Loop

(in reply to TNO)
 
 
Post #: 5
 
 RE: Browser Helper Object support Vbscript - 11/13/2008 4:20:04 AM   
  TNO


Posts: 1402
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
quote:

You're right TNO. But, this is only true if you create the instance of Internet Explorer


Actually, thats what the  ConnectObject method does. Anything that exposes a COM interface can be queried for its events. Like for instance the Office applications. Obviously there is a variety of ways to get a running instance of an application (like through WMI to check running processes and such)

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to dennisrobins)
 
 
Post #: 6
 
 RE: Browser Helper Object support Vbscript - 11/13/2008 4:21:47 AM   
  TNO


Posts: 1402
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
An example of another way to get an instance of an IE method you didn't start:

http://www.visualbasicscript.com/m_41907/mpage_1/key_popup/tm.htm#41907

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to TNO)
 
 
Post #: 7
 
 RE: Browser Helper Object support Vbscript - 11/13/2008 4:47:10 AM   
  dennisrobins

 

Posts: 5
Score: 0
Joined: 11/12/2008
Status: offline
Very nice, but I don't see anyway to subscribe to events with the examples. VBScript alone is ill-equipped for this. Consider that a stand alone VBScript would have to loop to 'catch' an event. In all likelyhood it would certainly miss enough to be unreliable. Something like this... http://www.microsoft.com/technet/scriptcenter/resources/qanda/jul05/hey0711.mspx is not optimal. Monitoring the state of IE using a similiar method is certainly inferior to BHO.VBS.

As always I appreciate your comments :)

quote:

ORIGINAL: TNO

An example of another way to get an instance of an IE method you didn't start:

http://www.visualbasicscript.com/m_41907/mpage_1/key_popup/tm.htm#41907

(in reply to TNO)
 
 
Post #: 8
 
 RE: Browser Helper Object support Vbscript - 11/13/2008 12:42:36 PM   
  TNO


Posts: 1402
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
Here's an example of how the method works:
http://www.nilpo.com/2008/07/windows-scripting/controlling-when-vbscript-events-are-handled/

and here's an explanation of where it wouldnt:
http://blogs.msdn.com/ericlippert/archive/2005/02/15/373330.aspx

So its possible to attach an event externally (or internally in the case of a browser). The concern with missing an event is pretty unlikely and a rare thing for most to do outside of the document itself anyway. (How many cases can you think of where someone would need to attach a listener without creating an instance anyway?)

The thing that is a concern is the fact that this requires installation and registration on one or more computers which makes it not very worthwhile compared to the native alternatives.

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to dennisrobins)
 
 
Post #: 9
 
 RE: Browser Helper Object support Vbscript - 11/14/2008 1:32:12 AM   
  dennisrobins

 

Posts: 5
Score: 0
Joined: 11/12/2008
Status: offline
Thanks TNO. I'll checkout the information. I appreciate your time in reviewing this :)

quote:

ORIGINAL: TNO

Here's an example of how the method works:
http://www.nilpo.com/2008/07/windows-scripting/controlling-when-vbscript-events-are-handled/

and here's an explanation of where it wouldnt:
http://blogs.msdn.com/ericlippert/archive/2005/02/15/373330.aspx

So its possible to attach an event externally (or internally in the case of a browser). The concern with missing an event is pretty unlikely and a rare thing for most to do outside of the document itself anyway. (How many cases can you think of where someone would need to attach a listener without creating an instance anyway?)

The thing that is a concern is the fact that this requires installation and registration on one or more computers which makes it not very worthwhile compared to the native alternatives.

(in reply to TNO)
 
 
Post #: 10
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Browser Helper Object support Vbscript Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts