Jump to content
Sign in to follow this  
kaotkbliss

Get $o_object if IE already exists

Recommended Posts

kaotkbliss

in order to pass the "refresh" command to IE using the _IEAction func, you need the first parameter

Object variable of an InternetExplorer.Application

Which is easy enough to get using _IECreate

But first I want to check if IE is already open, if not then _IECreate

but if it is I need to assign $o_object with the variable so I can use the _IEAction later on.

#include <IE.au3>
$flag = 0
AdlibRegister('_refresh', 50000)
If Not WinExists("Yahoo - Windows Internet Explorer") Then
 $o_object = _IECreate ("[url="http://www.Yahoo.com"]http://www.Yahoo.com[/url]")
Else
 ;need to assign $o_object here
EndIf

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites
digiworks

You can get the reference with _IEAttach as well which will let you attach to an already existing browser.

Share this post


Link to post
Share on other sites
kaotkbliss

yeah, but I don't want to create a 2nd instance of the website if it's already open.


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites
digiworks

#include <IE.AU3>
$flag = 0
;AdlibRegister('_refresh', 50000)
If Not WinExists("Yahoo! - Windows Internet Explorer") Then
    $o_object = _IECreate("http://www.yahoo.com")
Else
    $o_object = _IEAttach("http://www.yahoo.com/", "URL")
EndIf

This will open the browser to Yahoo if it doesn't already exist, otherwise it will look for a browser window with the yahoo URL. Check your window title too because yours says Yahoo - Windows Internet Explorer and mine says Yahoo! - Windows Internet Explorer.

Share this post


Link to post
Share on other sites
kaotkbliss

I'll try that, thanks.

I don't mess with IE functions very often so I'm not that good with them.

*edit* I missed the Opt("wintitlematchmode", 2)

but anyways, it does work. Thanks for the answer ;)

Edited by kaotkbliss

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites
jdelaney

<p>If you want to check for ANY IE browser, as a precursor (used object spy on IE9 browser):

#include <IE.AU3>
$flag = 0
;AdlibRegister('_refresh', 50000)

$hndIE = WinGetHandle( "[Class:IEFrame]" )
If Not ishwnd($hndIE) Then
    $o_object = _IECreate("[url="http://www.yahoo.com"]http://www.yahoo.com[/url]")
Else
    $o_object = _IEAttach($hndIE, "HWND")
EndIf
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

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  

×