Monty Posted January 29, 2011 Posted January 29, 2011 Hi all, I use websites (intranet) a lot at work, and most cases we have to load pages and enter login details. The issue that I am facing...when I load up any IE page using _IECreate, the page does load up, but ONLY SOMETIMES stays in background and does not come in front. I have tried several ways to bring this page to front but issue is still there. Here are 3 ways that I have tried... ==================================================== Google is just examples. Cant use work intranet at home. ==================================================== Way 1) --------------- $oIE = _IECreate("www.google.com") WinActivate($oIE, "") Way 2) --------------- $oIE = _IECreate("www.google.com") $oIE_title = _IEPropertyGet($oIE, "title") WinActivate($oIE_title, "") Way 3) - got desperate --------------- $oIE = _IECreate("www.google.com") $oIE_title = _IEPropertyGet($oIE, "title") Do WinActivate($oIE_title, "") Until WinActive($oIE_title, "") ==================================================== Is there another way of doing this. Why I have to do this is because some sites I cannot read id or name and have to use controlsend command. And if these windows stay in background, the logins fail. PLEASE HELP!!!
JohnOne Posted January 29, 2011 Posted January 29, 2011 #include <IE.au3> Opt("WinTitleMatchMode",2) $oIE = _IECreate("www.google.com") WinWait("Internet Explorer") $hwnd = WinActivate("Internet Explorer") AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
hench Posted January 29, 2011 Posted January 29, 2011 (edited) Hellow!A suggestion for the usage of _IEGetProperty, you could use "hwnd", instead of "title", this will give you the Window handle, which is much more efficient than the title !!!!That is odd because by default, _IECreate will bring the created instance into focus automatically, there is a WinActivate in the function.From my point of view, forcing a WinActivate using the window handle is definitely the best call you can make!!!but stick it in a loop :#include <ie.au3> ; Create IE instance Local $oIE = _IECreate("www.google.com") Local $hIE ; Force to get window handle While Not IsHWnd($hIE) $hIE = _IEPropertyGet($oIE, "hwnd") Sleep(10) WEnd ConsoleWrite($hIE & @CRLF) ; Force activation of window While Not WinActive($hIE) WinActivate($hIE) Sleep(10) WEnd ; Bye-bye ExitGood luck!! Edited January 29, 2011 by hench
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