Jump to content
Sign in to follow this  
scriptkitty

Beta version - IE fun

Recommended Posts

I thought I would write up a few things to get folks started playing with the new features comming to stable soon, but in beta now.

There are a lot of possiblilities, so if you would like to get started, here ya go.

This opens IE where you want, what size you like, and with toolbars, menubar, statusbar, or not. A few other tidbits like two ways to know when the page is done.

; direct access via COM 
; available in current beta version

$ObjIE=ObjCreate("InternetExplorer.Application")

With $ObjIE
;  .Visible = True
.Navigate("http://www.autoitscript.com")
.left=200
.top=200
.height=400
.width=800
.menubar=0
.toolbar=0
.statusBar=0
.visible=1
; usefull information
;.top = <integer>
;.left = <integer>
;.width = <integer>
;.height = <integer>
;.visible = <integer>;(1 - Visible/ 0 - Not Visible)
;.menuBar = <integer>;(1 - Visible/ 0 - Not Visible)
;.toolBar = <integer>;(1 - Visible/ 0 - Not Visible)
;.statusBar = <integer>;(1 - Visible/ 0 - Not Visible)
;.goHome; to go to home
;.document.body.innerHTML; the HTML of the page
;.document.body.innerText; the text displayed on the page
;.submit; does standard submit if you called out a form
;.button.click() ; clicks a standard button
;.fieldname.value = "myvalue"; changes the information 
while .busy
   tooltip("loading")
   sleep(10)
WEnd
;  alternate way
;  Do
;   Sleep(50)
;  Until .ReadyState = 4
   tooltip("")
EndWith


MsgBox(1,"innertext",lines($ObjIE.document.body.innerText,20))
MsgBox(1,"innerhtml",lines($ObjIE.document.body.innerHTML,20))

func lines($_text,$_lines)
   return stringleft($_text,stringinstr($_text,@cr,0,$_lines))
EndFunc

DaleHohm had a nice way to connect to an exhisting one, I changed it to a function and added a few things.

func IE_connect()
; returns the internet explorer object if sucessful or makes a new one if not found
; mainly from DaleHohm's code

Dim $ObjShell = ObjCreate("Shell.Application")
Dim $ObjShellWindows = $ObjShell.Windows(); collection of all ShellWindows (IE and File Explorer)
Dim $ObjIE

For $Window in $ObjShellWindows
    If StringInStr($window.LocationURL,"https:")>0 or StringInStr($window.LocationURL,"http:")>0 or StringInStr($window.LocationURL,"ftp:")>0 Then
        $ObjIE = $Window
        Return $ObjIE; We found it...
    EndIf
Next
    $ObjIE=ObjCreate("InternetExplorer.Application")
Return $ObjIE
EndFunc

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

Sorry for the newb question, but are the new browser functions in the beta version exclusive to IE or can they be applied to other browsers like Firefox?

Share this post


Link to post
Share on other sites

The new functions are for use on anything that uses COM.

What is COM?

COM stands for "Component Object Model". It is the Microsoft way to interconnect software using a common interface.  These interfaces are defined in a COM Object.

Before COM, you had to know the exact implementation of a program before you could 'interface' with it. Using COM, you can now "talk" to its defined Object(s).  The only things you have to know are the names of the Objects that are used and which 'properties' or 'methods' they have.

Therefore in theory you can use this on any browser.

Now for the bad news:

Mozilla based browsers have no COM support. I chatted for a few hours with some devs, and a lot of others, read a lot of web info and... Not going to happen.

At least not for a while.


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...