litlmike Posted February 2, 2007 Share Posted February 2, 2007 (edited) Trying to make a WYSIWYAF using IE.au3 (What You See Is What You Asked For). But When I try to write the HTML to the IE Object I get: Can someone enlighten me? Thanks. --> IE.au3 Error from function _IELoadWait, $_IEStatus_InvalidDataType Updated code expandcollapse popup#include <GUIConstants.au3> #include <IE.au3> $GUI_Width = @DesktopWidth-100 $GUI_Height = @DesktopHeight-100 $Form2 = GUICreate("Tabbed Notebook Dialog", 1095, 822, 2, -4) GUISetIcon("D:05.ico") $PageControl1 = GUICtrlCreateTab(8, 8, 924, 712) $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") $Edit1 = GUICtrlCreateEdit("", 24, 48, 889, 649) $TabSheet2 = GUICtrlCreateTabItem("TabSheet2") ;Creates Object for IE $oIE = ObjCreate("Shell.Explorer.2") ;Creates Object for IE in GUI $GUIActiveX = GUICtrlCreateObj ( $oIE, 50, 50 , 800 , 600 ) ;~ $oIE.navigate("http://www.autoitscript.com") $Group1 = GUICtrlCreateGroup("Group1", 10, 850, 475, 75) $Group1_Top = $GUI_Height - 50 $Group1_Left = $GUI_Width - 150 $GUI_Button_Back = GuiCtrlCreateButton ("Back", 15, $Group1_Top, 100, 30) $GUI_Button_Forward = GuiCtrlCreateButton ("Forward", 120, $Group1_Top, 100, 30) $GUI_Button_Home = GuiCtrlCreateButton ("Home", 230, $Group1_Top, 100, 30) $GUI_Button_Stop = GuiCtrlCreateButton ("Stop", 330, $Group1_Top, 100, 30) GUICtrlCreateGroup ("",-99,-99,1,1) ;close group GUICtrlCreateTabItem("") $Group1 = GUICtrlCreateGroup("AGroup1", 632, 728, 297, 97) $Button1 = GUICtrlCreateButton("&OK", 646, 760, 75, 25, 0) $Button2 = GUICtrlCreateButton("&Cancel", 726, 760, 75, 25, 0) $Button3 = GUICtrlCreateButton("&Help", 808, 760, 75, 25, 0) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("AGroup2", 16, 736, 457, 81) $Button4 = GUICtrlCreateButton("WYSIWYAF", 24, 760, 193, 49, 0) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button4 $HTML = GUICtrlRead ($Edit1) _IEDocWriteHTML ( $oIE, $HTML ) EndSwitch WEnd Edited February 3, 2007 by litlmike _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
NELyon Posted February 3, 2007 Share Posted February 3, 2007 I'm not sure about the error, but it would save a lot of hassle and bug reports in the future if you replaced _IEBodyWriteHTML with _IEDocWriteHTML Link to comment Share on other sites More sharing options...
litlmike Posted February 3, 2007 Author Share Posted February 3, 2007 I'm not sure about the error, but it would save a lot of hassle and bug reports in the future if you replaced _IEBodyWriteHTML with _IEDocWriteHTMLCool, I made the change, and after reading the Help File, understand why you said to change it. I am still stuck with the same issue however.I have a feeling it has to do with how the string from GuiCtrlRead is Saved and how _IEDocWriteHTML accepts strings. _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
DaleHohm Posted February 3, 2007 Share Posted February 3, 2007 Nope... _IELoadWait is called by _IEBodyWriteHTML (and _IEDocWriteHTML). I takes one parameter, in this case $oIE and the console message says it is not of a valid datatype, meaning it is not an object variable. You need to backtrack and use isObj() to test $oIE to see whether it is getting created properly. 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...
litlmike Posted February 3, 2007 Author Share Posted February 3, 2007 (edited) Nope... _IELoadWait is called by _IEBodyWriteHTML (and _IEDocWriteHTML). I takes one parameter, in this case $oIE and the console message says it is not of a valid datatype, meaning it is not an object variable. You need to backtrack and use isObj() to test $oIE to see whether it is getting created properly. Dalesoooooo..... I think I understood what you mean. Here is the output and revised code: OutPut: expandcollapse popupIsObj ($oIE) = 1 IsObj ($GUIActiveX) = 0oÝ÷ Ù«¢+Ø(¥¹±Õ±ÐíU% ½¹ÍѹÑ̹ÔÌÐì(¥¹±Õ±Ðí%¹ÔÌÐì((ÀÌØíU%}]¥Ñ ôÍѽÁ]¥Ñ ´ÄÀÀ(ÀÌØíU%}!¥¡ÐôÍѽÁ!¥¡Ð´ÄÀÀ(ÀÌØí½É´ÈôU% ÉÑ ÅÕ½ÐíQ9½Ñ½½¬¥±½ÅÕ½Ðì°ÄÀäÔ°àÈÈ°È°´Ð¤)U%MÑ%½¸ ÅÕ½ÐíèÀÔ¹¥¼ÅÕ½Ðì¤(ÀÌØíA ½¹Ñɽ°ÄôU% Ñɱ ÉÑQ à°à°äÈаÜÄȤ(ÀÌØíQM¡ÐÄôU% Ñɱ ÉÑQ%Ñ´ ÅÕ½ÐíQM¡ÐÄÅÕ½Ðì¤(ÀÌØí¥ÐÄôU% Ñɱ ÉѥРÅÕ½ÐìÅÕ½Ðì°ÈаÐà°ààä°ØÐä¤((ÀÌØíQM¡ÐÈôU% Ñɱ ÉÑQ%Ñ´ ÅÕ½ÐíQM¡ÐÈÅÕ½Ðì¤($í ÉÑÌ=©Ð½È%($ÀÌØí½%ô=© ÉÑ ÅÕ½ÐíM¡±°¹áÁ±½ÉȸÈÅÕ½Ðì¤($% ½¹Í½±]É¥Ñ ÅÕ½Ðí%Í=¨ ÀÌØí½%¤ôÅÕ½ÐìµÀì%Í=¨ ÀÌØí½%¤µÀì I1¤(($í ÉÑÌ=©Ð½È%¥¸U$($ÀÌØíU%Ñ¥Ù`ôU% Ñɱ ÉÑ=¨ ÀÌØí½%°ÔÀ°ÔÀ°àÀÀ°ØÀÀ¤($% ½¹Í½±]É¥Ñ ÅÕ½Ðí%Í=¨ ÀÌØíU%Ñ¥Ù`¤ôÅÕ½ÐìµÀì%Í=¨ ÀÌØíU%Ñ¥Ù`¤µÀì I1¤(($ÀÌØíɽÕÀÄôU% Ñɱ ÉÑɽÕÀ ÅÕ½ÐíɽÕÀÄÅÕ½Ðì°ÄÀ°àÔÀ°ÐÜÔ°ÜÔ¤$($$ÀÌØíɽÕÀÅ}Q½ÀôÀÌØíU%}!¥¡Ð´ÔÀ($$ÀÌØíɽÕÀÅ}1ÐôÀÌØíU%}]¥Ñ ´ÄÔÀ($$ÀÌØíU%} ÕÑѽ¹} ¬ôÕ¥ Ñɱ ÉÑ ÕÑѽ¸ ÅÕ½Ðí ¬ÅÕ½Ðì°ÄÔ°ÀÌØíɽÕÀÅ}Q½À°ÄÀÀ°ÌÀ¤($$ÀÌØíU%} ÕÑѽ¹}½ÉÝÉôÕ¥ Ñɱ ÉÑ ÕÑѽ¸ ÅÕ½Ðí½ÉÝÉÅÕ½Ðì°ÄÈÀ°ÀÌØíɽÕÀÅ}Q½À°ÄÀÀ°ÌÀ¤($$ÀÌØíU%} ÕÑѽ¹}!½µôÕ¥ Ñɱ ÉÑ ÕÑѽ¸ ÅÕ½Ðí!½µÅÕ½Ðì°ÈÌÀ°ÀÌØíɽÕÀÅ}Q½À°ÄÀÀ°ÌÀ¤($$ÀÌØíU%} ÕÑѽ¹}MѽÀôÕ¥ Ñɱ ÉÑ ÕÑѽ¸ ÅÕ½ÐíMѽÀÅÕ½Ðì°ÌÌÀ°ÀÌØíɽÕÀÅ}Q½À°ÄÀÀ°ÌÀ¤(%U% Ñɱ ÉÑɽÕÀ ÅÕ½ÐìÅÕ½Ðì°´ää°´ää°Ä°Ä¤í±½ÍɽÕÀ()U% Ñɱ ÉÑQ%Ñ´ ÅÕ½ÐìÅÕ½Ðì¤(ÀÌØíɽÕÀÄôU% Ñɱ ÉÑɽÕÀ ÅÕ½ÐíɽÕÀÄÅÕ½Ðì°ØÌÈ°ÜÈà°ÈäÜ°äܤ(ÀÌØí ÕÑѽ¸ÄôU% Ñɱ ÉÑ ÕÑѽ¸ ÅÕ½ÐìµÀí=,ÅÕ½Ðì°ØÐØ°ÜØÀ°ÜÔ°ÈÔ°À¤(ÀÌØí ÕÑѽ¸ÈôU% Ñɱ ÉÑ ÕÑѽ¸ ÅÕ½ÐìµÀí ¹°ÅÕ½Ðì°ÜÈØ°ÜØÀ°ÜÔ°ÈÔ°À¤(ÀÌØí ÕÑѽ¸ÌôU% Ñɱ ÉÑ ÕÑѽ¸ ÅÕ½ÐìµÀí!±ÀÅÕ½Ðì°àÀà°ÜØÀ°ÜÔ°ÈÔ°À¤)U% Ñɱ ÉÑɽÕÀ ÅÕ½ÐìÅÕ½Ðì°´ää°´ää°Ä°Ä¤(ÀÌØíɽÕÀÈôU% Ñɱ ÉÑɽÕÀ ÅÕ½ÐíɽÕÀÈÅÕ½Ðì°ÄØ°ÜÌØ°ÐÔÜ°àĤ(ÀÌØí ÕÑѽ¸ÐôU% Ñɱ ÉÑ ÕÑѽ¸ ÅÕ½Ðí]eM%]eÅÕ½Ðì°ÈаÜØÀ°ÄäÌ°Ðä°À¤)U% Ñɱ ÉÑɽÕÀ ÅÕ½ÐìÅÕ½Ðì°´ää°´ää°Ä°Ä¤)U%MÑMÑÑ¡M]}M!=¤(()]¡¥±Ä($ÀÌØí¹5ÍôU%Ñ5Í ¤(%MÝ¥Ñ ÀÌØí¹5Í($% ÍÀÌØíU%}Y9Q} 1=M($$%á¥Ð($$($% ÍÀÌØí ÕÑѽ¸Ð($$$ÀÌØí!Q50ôU% ÑɱI ÀÌØí¥ÐĤ(íø$$%5Í ½à À°ÅÕ½ÐìÅÕ½Ðì°ÀÌØí!Q50Ȱ̤($$%}%½]É¥Ñ!Q50 ÀÌØí½%°ÀÌØí!Q50¤((%¹MÝ¥Ñ )]¹( Edited February 3, 2007 by litlmike _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
DaleHohm Posted February 3, 2007 Share Posted February 3, 2007 I'm not trying to pick on you Mike, but you've been doing this long enough and you're doing involved enough stuff that you should be better at troubleshooting it by now. Have you figured out exactly what line in your script ends up triggering the error message? [hint: look in the SciTe tools menu for the word Trace] Once you find that, narrow your focus more... use the isObj test there. BTW, GUICtrlCreateObj does not return an object, but rather creates a container for an object -- look at the function definition in the helpfile to verify what it returns on success. 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...
litlmike Posted February 23, 2007 Author Share Posted February 23, 2007 (edited) I'm not trying to pick on you Mike, but you've been doing this long enough and you're doing involved enough stuff that you should be better at troubleshooting it by now. Have you figured out exactly what line in your script ends up triggering the error message? [hint: look in the SciTe tools menu for the word Trace] Once you find that, narrow your focus more... use the isObj test there. BTW, GUICtrlCreateObj does not return an object, but rather creates a container for an object -- look at the function definition in the helpfile to verify what it returns on success. DaleAgreed, my troubleshooting sucks. Thanks for directing me to Trace, I always wondered what that did. From it, I get the following. What I don't understand is that the error code says invalid data type. $oIE is an IE object, thus shouldn't _IEDocWriteHTML accept that object? Does error code: 3 tell me anything specific? More importantly, HOW DO I TROUBLESHOOT THIS? Thanks. @@ Trace(103) : _IEDocWriteHTML ( $oIE, $HTML ) --> IE.au3 Error from function _IELoadWait, $_IEStatus_InvalidDataType >Error code: 3 Edited February 24, 2007 by litlmike _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
litlmike Posted February 24, 2007 Author Share Posted February 24, 2007 Now that I consider this more I am starting to think the problem might lie in this line of code. I took this line from the help file and now that I look back on it, if this were to be the wrong kind of object, then could this cause the error? It seems that _IEDocWriteHTML/_IELoadWait doesn't like the object $oIE. So do you think this line should be changed, and how can I know trouble shoot that in the future? $oIE = ObjCreate("Shell.Explorer.2") _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Will66 Posted February 24, 2007 Share Posted February 24, 2007 Trying to make a WYSIWYAF using IE.au3 (What You See Is What You Asked For)Hi litlmike, Googled WYSIWYAF, still not sure what it is. Started a Wysiwyg project, maybe your interested: http://www.autoitscript.com/forum/index.ph...mp;#entry307503 Link to comment Share on other sites More sharing options...
DaleHohm Posted February 24, 2007 Share Posted February 24, 2007 (edited) Agreed, my troubleshooting sucks. Thanks for directing me to Trace, I always wondered what that did. From it, I get the following. What I don't understand is that the error code says invalid data type. $oIE is an IE object, thus shouldn't _IEDocWriteHTML accept that object? Does error code: 3 tell me anything specific? More importantly, HOW DO I TROUBLESHOOT THIS? Thanks.Hi Mike -- glad to see you come back to this. Regarding your troubleshooting -- the fact that you're willing to learn is the important part for me. I am much more willing to help the person who is trying to learn to fish and shows some respect than the person who wants to be handed a fish - no matter how much gratitude they express. So, to your problem... It is a little complex, but I can explain the cause and solution. I do not expect you to as easily diagnose the core issue because you don't know the IE.au3 internals the way that I do -- the critical thing you have now given me however is the line of code and the associated command that created the error. From that it was easy for me to guess and confirm the issue. Error 3 is simply the numeric @error value for "Invalid Data Type" as defined in _IEDocWriteHTML. From the helpfile:3 ($_IEStatus_InvalidDataType) = Invalid Data Type It turns out that $oIE is in fact a valid browser data type (ObjName($oIE) shows IWebBrowser2 which is what we need). Unfortunately, what _IEDocWriteHTML really needs to act upon is a document object - $oIE.document. IE.au3 functions typically takes a browser object as input and then automatically add the .document or other translations to simplify the interface so that you don't have to know that one function acts on the browser and another on the document etc. [Note that a function like _IEDocWriteHTML will accept a browser OR document object as input and do the right thing]. OK, so why are you having trouble? The issue is that you created a browser object and assigned it to $oIE properly (btw, your ObjCreate does essentially the same thing as _IECreateEmbedded), however, this browser object does not get an associated .document object until you tell it to Navigate somewhere (until it has something to display). _IEDocWriteHTML checks and sees that you passed a proper browser object, but then calls _IELoadWait with $oIE.document -- THAT is not an object because of what I explained above and thus the error. ** You can fix this issue by simply adding an _IENavigate($oIE, "about:blank") after your call to GUICtrlCreateObj.** Note that "about:blank" is treated like a URL but is actually an IE function that creates a blank page. This is enough to create the .document object however and everything starts to work. I try to trap and report all errors like this, but this is a path I had not considered. I'll see about doing more with this in the next release. Note that a browser object created with _IECreate does not experience this because it automatically navigates to about:blank when no URL is specified. _IECreateEmbedded cannot do this however because you cannot Navigate with that object until it has been embedded in the GUI with GUICtrlCreateObj. Dale Edit: typo Edited February 24, 2007 by DaleHohm 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...
litlmike Posted February 27, 2007 Author Share Posted February 27, 2007 @Dale Ahhhhh, that makes sense; having to nav. somewhere before it can interact with that object, and why the embedded object cannot nav. somewhere without the object being created. It worked perfectly once I added that line. Is there anything else I could have done to answer this problem myself originally? And thank you, I do want to learn how to fish. _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
DaleHohm Posted February 28, 2007 Share Posted February 28, 2007 Isolating the line of code and verifying that you passed a valid object to the function were the critical steps. It was easy for me at that point. If you had wanted to go further, I suggest you could have then disected _IEDocWriteHTML by copying it to your script and renaming it to something like _MyDocWriteHTML - then calling it instead of the _IE routine. You could then have put in debugging statements or trace lines to discover the source of trouble in that function, then done IsObj and ObjName tests to discern why you got the error. 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...
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