PsaltyDS Posted July 19, 2007 Posted July 19, 2007 So, another post got me thinking... can you _IEAttach() to a browser embedded as a control in an AutoIt window? My demo is two scripts. One creates an AutoIt GUI with an embedded IE object for a control. The second script looks for the first one, and offers to navigate it to Google's page. expandcollapse popup; Script One - The Embedded IE GUI #include <ie.au3> #include <guiconstants.au3> Opt("GuiOnEventMode", 1) $hGUI = GUICreate("Embedded IE", 600, 400) GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit") $oIE = _IECreateEmbedded() GUICtrlCreateObj($oIE, 10, 10, 580, 340) $Button1 = GUICtrlCreateButton("OpenOffice.org", 125, 360, 100, 30) GUICtrlSetOnEvent(-1, "_Go") $Button2 = GUICtrlCreateButton("Mozilla", 375, 360, 100, 30) GUICtrlSetOnEvent(-1, "_Go") _IENavigate($oIE, "about:Blank", 0) GUISetState() While 1 Sleep(20) WEnd Func _Go() Switch @GUI_CtrlId Case $Button1 _IENavigate($oIE, "http://www.OpenOffice.org", 0) Case $Button2 _IENavigate($oIE, "http://www.Mozilla.org", 0) EndSwitch EndFunc ;==>_Go Func _Quit() Exit EndFunc ;==>_QuitoÝ÷ Ù«¢+ØìMÉ¥ÁÐQݼ´Ñй9Ù¥Ñ((¥¹±Õ±Ðí¥¹ÔÌÐì()!½Ñ-åMÐ ÅÕ½ÐííM ôÅÕ½Ðì°ÅÕ½Ðí}EÕ¥ÐÅÕ½Ðì¤()=ÁÐ ÅÕ½Ðí]¥¹Q¥Ñ±5Ñ¡5½ÅÕ½Ðì°Ð¤()]¡¥±Ä(%%]¥¹á¥ÍÑÌ ÅÕ½Ðím 1MLéÕѽ%ÐØÌU$ìQ%Q1éµ%tÅÕ½Ðì¤Q¡¸($% ½¹Í½±]É¥Ñ ÅÕ½ÐíÕѽ%ÐÝ¥¹½Ü͸¸ÅÕ½ÐìµÀì1¤($$ÀÌØí¡%ô ½¹Ñɽ±Ñ!¹± ÅÕ½Ðím 1MLéÕѽ%ÐØÌU$ìQ%Q1éµ%tÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðím 1MLé%¹ÑɹÐáÁ±½ÉÉ}MÉÙÉtÅÕ½Ðì¤($%%9½ÐÉɽÈQ¡¸($$% ½¹Í½±]É¥Ñ ÅÕ½Ðí½Ð½¹Ñɽ°¡¹±¸ÅÕ½ÐìµÀì1¤($$$ÀÌØí½%ô}%ÑÑ ÀÌØí¡%°ÅÕ½Ðí!]9ÅÕ½Ðì¤($$%%9½ÐÉɽÈQ¡¸($$$%%5Í ½à ÌȬаÅÕ½Ðí ¡¹üÅÕ½Ðì°ÅÕ½Ðí ¡¹É½ÝÍÈѼ½½±üÅÕ½Ðì¤ôØQ¡¸}%9Ù¥Ñ ÀÌØí½%°ÅÕ½Ðí¡ÑÑÀè¼½ÝÝܹ½½±¹½´ÅÕ½Ðì¤($$%¹%($%¹%(%¹%(%M±À ÄÀÀ¤)]¹()Õ¹}EեР¤(%á¥Ð)¹Õ¹ìôôÐí}EեРRunning the first script, then the second detects the GUI and get the control handle, but _IEAttach() fails on no match. Can a brother get a poke with the clue stick...? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
DaleHohm Posted July 19, 2007 Posted July 19, 2007 Try _IEAttach with "embedded" using the GUI window title instead of using "hwnd" 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
PsaltyDS Posted July 19, 2007 Author Posted July 19, 2007 Try _IEAttach with "embedded" using the GUI window title instead of using "hwnd" Dale Doh! I had to look up the HWND option in the help file, and EMBEDDED was right there below it. How did I miss that? Works fine with just that change: $oIE = _IEAttach("[CLASS:AutoIt v3 GUI; TITLE:Embedded IE]", "embedded") :"> Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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