Sign in to follow this  
Followers 0
tommytx

Using a window handle to control the browser....

6 posts in this topic

$hGUI = "0x001D05E0"

WinActivate($hGUI)

I took the number in quotes by cut and paste the handle from the autoit window information program..

Is there a reason why this cannot be used direct like this. When I use the browser like below to load IE and use 'WinGetHandle" as shown.. the $hGUI can now be used to do a WinActivate normally...

I can even say $dog = $hGUI and then say WinActivate($dog) and all is well.... however when i type the handle number into the variable as above it will not work with the WinActivate($hGUI)

$oIE = _IECreate ($url)

Global $hGUI = WinGetHandle("File 1")

Am I doing something wrong?

Share this post


Link to post
Share on other sites



A unique random handle to a window is generated for each instance of a window.

$hGUI = "0x001D05E0" is useless when you closed the window that had the window handle, "0x001D05E0", that you cut and paste from the AutoIt window information program. The next instance of that same window will have a different unique window handle for as long as the window exists.

The "Class" of the window from the same application being run, does not change with each instance.

In this example, each time the application, Internet Explorer is run, the Internet Explorer's window has the same class, IEFrame. The class type was obtained from the AutoIt window information program.

;Local $hGUI = WinGetHandle("[REGEXPCLASS:MozillaUIWindowClass|IEFrame]"); Matches FireFox first, only if it exists, then if fireFox does not exist matches Internet Explorer.
Local $hGUI = WinGetHandle("[Class:IEFrame]")

WinSetState($hGUI, "", @SW_HIDE)
Sleep(3000)
WinSetState($hGUI, "", @SW_SHOW)

Share this post


Link to post
Share on other sites

Wow! Thanks JohnOne... that was exactly what I needed.... I would never have guessed the ascii handle saved in a text file would need conversion.... you are sooooo... smart.... Tanks...

I am trying to run 4 copies of the same web page in 4 windows and of course since they are all the same title and text I must know the handle to talk to them individually..

Also for all the other folks who offered solutions thank you also...

Share this post


Link to post
Share on other sites

You can also use the instance parameter of _IEAttach. Just use the matching mode you want (title, url, etc) and then instances 1, 2, 3 and 4.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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  
Followers 0