webxt Posted April 5, 2009 Share Posted April 5, 2009 (edited) Ok, i have this code: #include <IE.au3> $IE = _IECreate("http://www.yahoo.com",0,1,1,1) _IELoadWait ($IE) WinSetState("Yahoo!", "", @SW_MAXIMIZE) 1. How can I set active window (to be sure maximizing that thing and nothing else) ? 2. How can I check if user closed the browser? Thanks. Edited April 5, 2009 by webxt Link to comment Share on other sites More sharing options...
exodius Posted April 5, 2009 Share Posted April 5, 2009 (edited) Like this: #include <IE.au3> $oIE = _IECreate("http://www.yahoo.com") $hWND = WinGetHandle(_IEPropertyGet($oIE, "title")) WinSetState($hWND, "", @SW_MAXIMIZE) WinActivate($hWND) While 1 Sleep (100) If Not WinExists ($hWND) Then ExitLoop WEnd MsgBox (0, "", "It's gone!") Edited April 5, 2009 by exodius Link to comment Share on other sites More sharing options...
webxt Posted April 5, 2009 Author Share Posted April 5, 2009 Simply perfect. Thanks! Link to comment Share on other sites More sharing options...
webxt Posted April 5, 2009 Author Share Posted April 5, 2009 (edited) Well.. msgbox does not appear if user close the browser before maximize. Solution? Edited April 5, 2009 by webxt Link to comment Share on other sites More sharing options...
TerarinK Posted April 5, 2009 Share Posted April 5, 2009 #include <IE.au3> $oIE = _IECreate("http://www.yahoo.com", 0, 1, 0) $hWND = WinGetHandle(_IEPropertyGet($oIE, "hwnd")) WinSetState($hWND, "", @SW_MAXIMIZE) WinActivate($hWND) While 1 Sleep (100) If Not WinExists ($hWND) Then ExitLoop WEnd MsgBox (0, "", "It's gone!") Because you are waiting till after the window finished creating. This script disables that and search for a hwnd when doing the search you should also note the increase in speed of the overall product when finished, like it makes any difference as it is all waiting at the end for you to connect. 0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E Link to comment Share on other sites More sharing options...
DaleHohm Posted April 5, 2009 Share Posted April 5, 2009 Just a comment... _IEPropertyGet($oIE, "hwnd") returns the window handle, so that is no need to wrap that in another WinGetHandle 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 Link to comment Share on other sites More sharing options...
webxt Posted April 5, 2009 Author Share Posted April 5, 2009 Thanks guys, worked like a charm. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now