Jump to content
Sign in to follow this  
flyingboz

COM and IE

Recommended Posts

I have gone through the forums and MSDN looking for the best way to accomplish the following without much success:

Using COM and IE, I logon to a website,

$IE = ObjCreate ("InternetExplorer.Application")
$IE.UserName.value = "username"
$IE.PassWord.value = "password"
$IE.submit.click ()
;wait for new page to load
$IE.LocationURL

This takes me one of several pages, unfortunately, they all have the same name,

and I need to parse the text from the resulting URL.

Edited by flyingboz

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

Necessity being the mother of invention, I kept hunting...Eventually turned up something in a python news group indicating that Shell.Application might be of use.

Searching the forums again, found scriptkitty's post on com/ie/frames, which pointed me in the write direction.

If I understand what has to be done, each time you execute a InternetExplorer.Application.document.forms.submit.click operation, to figure out where you are and preserve session values, you have to go track down the proper instance of IE again. I don't have a firm handle on when you have to do this and when you don't, so I guess I will discover by trial and error. Any pointers / references the COM gurus have would be welcome.

Thx to ScriptKitty and his code, along w/ Sven and his samples, they really helped.

If folks are interested, I'll take a look at putting a sample together from the UDFs I'll have to build to support my project.


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

Actually if you do it all in one script, you don't have to keep attaching.

Once you have a com object, it stays until you crash the script, exit kill that process, or assign a new variable to that object variable. In a matter of speaking.

You might also want to set up an error trap.

#include myobjfunc.au3
$IEobject=ieconnect()
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc"); Install a custom error handler 

do
sleep(10)
until stringinstr($IEobject.document.document.body.outerHTML,"some text or html")>0  and $IEobject.ready
msgbox(1,"info","found the right page")

Func MyErrFunc() 
sleep(100); look in help for real one.
Endfunc

with this approach, you can navigate as fast as the page is loaded, and you can set on of these up to do it while minimised if you like.

did it mostly off the top of my head, so might be a bit off.


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...