Jump to content
Sign in to follow this  
Jewtus

IEAttach or create

Recommended Posts

Jewtus

I was wondering if there is a UDF or anything that will automatically detect if an IE window is open and bind to it and if not, create a new IE window. I've been trying to figure out a way to do it with if statements but its getting really cumbersome and I feel like this is something that someone else must have already figured out.

Share this post


Link to post
Share on other sites
computergroove

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites
Jewtus

Review the help file entry _IECreate, specifically the $iTryAttach optional parameter.

I tried that, however it keeps not recognizing that there is an IE window open.

Winexists requires that I know something about the IE window. I did take a look at process exists, but once I have the PID, how do I actually attach to it?

 

EDIT: I think I've figured it out

If ProcessExists("iexplore.exe") <> 0 Then
                    $oIEhWND= _WinAPI_EnumProcessWindows(ProcessExists('iexplore.exe'))[1][0]
                    $oIE=_IEAttach($oIEhWND,"hwnd",1)
                    _IENavigate($oIE,$url)
                Else
                    $oie=_IECreate($url,1)
                EndIf
Edited by Jewtus

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  

×