bills Posted June 28, 2007 Share Posted June 28, 2007 (edited) when im visiting a page, a popup appears. This popup has different titles every time. Im trying to get my script to get the full adress url to the page in that popup but i cant seem to get it to attach to a variable. This is the code as i have it now.. I have tried a few different versions but noone seem to be able to attach the latest window to $grabsite. The popup doesnt contain a control called "Internet Explorer_Server1" but it contains a control called "Internet Explorer_Server". Func Button13() $title = WinGetTitle("Microsoft Internet Explorer") $winclass1 = WinGetHandle($title) MsgBox(0, "Handle", $winclass1) WinActivate($title) $grabsite = _IEAttach($title) If @error Then If @error = 7 Then $error = "No Match" ElseIf @error = 5 Then $error = "Invalid Value" ElseIf @error = 0 Then $error = "No Error" Else $error = "Unknown Error" EndIf $svar = MsgBox(1, "Error:", $error) EndIf If $svar = 2 Then _IEQuit($oIE) _IEQuit($oIE2) Exit Else $grabbedurl = _IEPropertyGet ($winclass1, "locationurl") MsgBox(0, "Grabbed url:", $grabbedurl) _IENavigate($oIE2, $grabbedurl) _IEQuit($grabsite) EndIf EndFunc Any ideas? Edited June 28, 2007 by bills Link to comment Share on other sites More sharing options...
bills Posted June 28, 2007 Author Share Posted June 28, 2007 No one? Im all stuck. Trying everything but im new to all this so it takes a long time to learn. Im thinking maybe handles could work since the _ieattach wont find the window with the correct title? Link to comment Share on other sites More sharing options...
mikehunt114 Posted June 28, 2007 Share Posted June 28, 2007 Do you mean the Window Class is "Internet Explorer_Server"? IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
bills Posted June 28, 2007 Author Share Posted June 28, 2007 Yes either that or IEFrame. Thats the info i get from the autoit v3 window info tool. Link to comment Share on other sites More sharing options...
mikehunt114 Posted June 28, 2007 Share Posted June 28, 2007 Try Opt("WinTitleMatchMode", 2). IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
bills Posted June 28, 2007 Author Share Posted June 28, 2007 I have that enabled already. Also tried Opt("WinTitleMatchMode", 4) and _IEAttach("[CLASS:IEFrame]"). Didnt work either Link to comment Share on other sites More sharing options...
mikehunt114 Posted June 28, 2007 Share Posted June 28, 2007 How about _IEAttach("Explorer", "WindowTitle"). IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
bills Posted June 28, 2007 Author Share Posted June 28, 2007 This returns @error = 5 from _ieattach Link to comment Share on other sites More sharing options...
mikehunt114 Posted June 28, 2007 Share Posted June 28, 2007 Ah, try using _IEAttach with the "DialogBox" mode. IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
bills Posted June 28, 2007 Author Share Posted June 28, 2007 (edited) Now i dont get any error but it still doesnt work. This is what i got: Func Button13() $title = WinGetTitle("Microsoft Internet Explorer") WinActivate($title) $grabsite = _IEAttach($title, "DialogBox") MsgBox(0, "attachressult", $grabsite) If @error Then If @error = 7 Then $error = "No Match" ElseIf @error = 5 Then $error = "Invalid Value" ElseIf @error = 0 Then $error = "No Error" Else $error = "Unknown Error" EndIf $svar = MsgBox(1, "Error:", $error) If $svar = 2 Then _IEQuit($oIE) _IEQuit($oIE2) Exit Else EndIf $grabbedurl = _IEPropertyGet ($grabsite, "locationurl") MsgBox(0, "Grabbed url:", $grabbedurl) _IENavigate($oIE2, $grabbedurl) _IEQuit($grabsite) EndIf EndFunc Seems to hang at "$grabbedurl = _IEPropertyGet ($grabsite, "locationurl")" cause i dont get the messagebox below. Edited June 28, 2007 by bills Link to comment Share on other sites More sharing options...
mikehunt114 Posted June 28, 2007 Share Posted June 28, 2007 (edited) Try simplifying your function to trap where the error is occuring. Ex: Func Button13() $title = WinGetTitle("Microsoft Internet Explorer") WinActivate($title) $grabsite = _IEAttach($title, "DialogBox") MsgBox(0, "attachressult", $grabsite) $grabbedurl = _IEPropertyGet ($grabsite, "locationurl") MsgBox(0, "Grabbed url:", $grabbedurl) _IENavigate($oIE2, $grabbedurl) _IEQuit($grabsite) EndFunc Edit: typo Edited June 28, 2007 by mikehunt114 IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
bills Posted June 28, 2007 Author Share Posted June 28, 2007 (edited) Yeah i just did this: Func Button13() $title = WinGetTitle("Microsoft Internet Explorer") WinActivate($title) $grabsite = _IEAttach($title, "DialogBox") MsgBox(0, "attachressult", $grabsite) MsgBox(0, "Test", "Test") $grabbedurl = _IEPropertyGet ($grabsite, "locationurl") MsgBox(0, "Grabbed url:", $grabbedurl) _IENavigate($oIE2, $grabbedurl) _IEQuit($grabsite) EndFunc And now it seems to work just wont close the window i attached ($grabsite) any ideas why? any idea why it wouldnt work with the errorcheckcode in the middle? Edited June 28, 2007 by bills Link to comment Share on other sites More sharing options...
mikehunt114 Posted June 28, 2007 Share Posted June 28, 2007 Try getting the window handle and closing it that way. As for why it doesn't work with your error code stuff in there, you are checking the expression:If @erroroÝ÷ ØÞ'¯zØb²+"Ê+ç-rbè®f(¹ªÞr)àzºè«"~+b±¦è¢Wö¥¹ëk¹ïßj[ÂÞ'¯{ +ɨ²Ú¶g²Z'«2¢èZ½é÷öÛµê뢻hj|)àÉëX¢ë!¢é]mç!yÉ"azö¥¹êzºè®)ìµæ)jëh×6If @error <> 0 ThenoÝ÷ ØZèØ^쨹Ƨv!jܨº±ën¤ÚuØíìË*.¬ìµ«^éíÁ«0®+mzv¬àjËaz·°jÉèzºè®)Ú¶Ö)à¶a{§v2¢ìéÞ½êà¢)à¶ÞiÈr¢êÈúè¥êíÈg)Þ=êáj2¢íýéh¢H§ú+²¶§X¤zØb±«¢+ÙÕ¹ ÕÑѽ¸ÄÌ ¤(ÀÌØíѥѱô]¥¹ÑQ¥Ñ± ÅÕ½Ðí5¥É½Í½Ð%¹ÑɹÐáÁ±½ÉÈÅÕ½Ðì¤(í]¥¹Ñ¥ÙÑ ÀÌØíѥѱ¤í$½¸ÌäíÐÑ¡¥¹¬å½Ô¹Ñ¡¥Ì(ÀÌØíÉÍ¥Ñô}%ÑÑ ÀÌØíѥѱ°ÅÕ½Ðí¥±½ ½àÅÕ½Ðì¤(5Í ½à À°ÅÕ½ÐíÑÑ¡ÉÍÍÕ±ÐÅÕ½Ðì°ÀÌØíÉͥѤ(%ÉɽȱÐìÐìÀQ¡¸(%ÉɽÈôÜQ¡¸(ÀÌØíÉɽÈôÅÕ½Ðí9¼5Ñ ÅÕ½Ðì(±Í%ÉɽÈôÔQ¡¸(ÀÌØíÉɽÈôÅÕ½Ðí%¹Ù±¥Y±ÕÅÕ½Ðì(±Í%ÉɽÈôÀQ¡¸(ÀÌØíÉɽÈôÅÕ½Ðí9¼ÉɽÈÅÕ½Ðì(±Í(ÀÌØíÉɽÈôÅÕ½ÐíU¹¹½Ý¸ÉɽÈÅÕ½Ðì(¹%(ÀÌØíÍÙÈô5Í ½à Ä°ÅÕ½ÐíÉɽÈèÅÕ½Ðì°ÀÌØíÉɽȤ(%ÀÌØíÍÙÈôÈQ¡¸(}%EեРÀÌØí½%¤(}%EեРÀÌØí½%Ȥ(á¥Ð(¹%(¹%(ÀÌØíÉÕÉ°ô}%AɽÁÉÑåÐ ÀÌØíÉͥѰÅÕ½Ðí±½Ñ¥½¹ÕÉ°ÅÕ½Ðì¤(5Í ½à À°ÅÕ½ÐíÉÕÉ°èÅÕ½Ðì°ÀÌØíÉÕÉ°¤(}%9Ù¥Ñ ÀÌØí½%È°ÀÌØíÉÕÉ°¤(}%EեРÀÌØíÉͥѤ(¹%)¹Õ¹ IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
bills Posted June 28, 2007 Author Share Posted June 28, 2007 Okay i get the errorpart but i cant close the window. This is what i got now: Func Button13() $title = WinGetTitle("Microsoft Internet Explorer") WinActivate($title) $oIE3 = _IEAttach($title, "DialogBox") $grabbedurlhandle = WinGetHandle($title) $grabbedurl = _IEPropertyGet ($oIE3, "locationurl") $grabbedurlcheck = StringLeft($grabbedurl, 7) If $grabbedurlcheck <> "http://" Then MsgBox(0, "Error", "Not a valid Url") Else MsgBox(0, "Grabbed URL:", $grabbedurl & @CRLF & @CRLF & "Opening in the right window!") _IENavigate($oIE2, $grabbedurl) _IEQuit($grabbedurlhandle) EndIf EndFunc Link to comment Share on other sites More sharing options...
mikehunt114 Posted June 28, 2007 Share Posted June 28, 2007 (edited) You have to use the IE object variable for _IEQuit: _IEQuit($oIE3)oÝ÷ ØêÞǦk&ÞÊj{¬zËZÖ«w§vºw-ì)Z)¢µ¢¨¥«¢+Ù]¥¹-¥±° ÀÌØíÉÕɱ¡¹±¤ Edited June 28, 2007 by mikehunt114 IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
bills Posted June 28, 2007 Author Share Posted June 28, 2007 THANKS! It all works great! Thank you for all your help and time Link to comment Share on other sites More sharing options...
mikehunt114 Posted June 28, 2007 Share Posted June 28, 2007 You're welcome IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] 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