Dylan Beck
Dylan Beck

Reputation: 197

AutoIT store an already open IE window into an object

I am trying to use use the _Navigate command to change the webpage. The issue is that The window will already be open and the only way I can see to use Navigate is to create the window yourself with Create.

Is there a way to somehow store an already opened IE window into an object and then use Navigate on that?

Thanks!

Upvotes: 0

Views: 622

Answers (1)

Daniel Haley
Daniel Haley

Reputation: 52878

You can use the _IEAttach function.

From the docs...

Attach to the specified instance of Internet Explorer where the search string sub-string matches (based on the selected mode)

#include <IE.au3>
_IEAttach ( $sString [, $sMode = "title" [, $iInstance = 1]] )

Parameters

$sString      String to search for (for "embedded" or "dialogbox", use Title sub-string or HWND of window) 
$sMode        [optional] specifies search mode
                 "title" = (Default) sub-string of main document title
                 "windowtitle" = sub-string of full window title (instead of document title)
                 "url" = sub-string or url of the current page
                 "text" = sub-string in text from the body of the current page
                 "html" = sub-string in html from the body of the current page
                 "hwnd" = hwnd of the browser window
                 "embedded" = title sub-string or hwnd of the window embedding the control
                 "dialogbox" = title sub-string or hwnd of modal/modeless dialogbox
                 "instance" = $sString is ignored, one browser reference returned (by matching instance number) from all available browser instances 
$iInstance    [optional] 1-based index into group of browsers or embedded browsers matching $sString and $sMode. See Remarks.

Return Value

Success:   an object variable pointing to the InternetExplorer Object for all but Embedded and DislogBox modes which return a Window Object. 
Failure:   sets the @error flag to non-zero. 
@error:    5 ($_IEStatus_InvalidValue) - Invalid Value
           7 ($_IEStatus_NoMatch) - No Match 
@extended: Contains invalid parameter number 

Upvotes: 0

Related Questions