LondonNDIB Posted December 31, 2010 Share Posted December 31, 2010 Hi. I used to be a lot more active with AutoIT, but I haven't used it much lately. One of my old scripts stopped working, I imagine with an update to IE. Functions such as _IEDocReadHTML and _IEBodyReadText no longer work (although they do work when used in conjunction with _IE_Example). So I came here to download a new version of AutoIt and discovered I already have it. Strangely (to me), the most current Beta is even older than the most current release, which was in April. So did AutoIt's development stop at some point? I see the forum is still active. Anyone have any idea about IE? For example, right out of the help file: #include <IE.au3> $oIE = _IE_Example ("basic") $sHTML = _IEDocReadHTML ($oIE) MsgBox(0, "Document Source", $sHTML) That works... but now instead of _IE_Example, let's use this: #include <IE.au3> $oIE = _IECreate ("http://www.microsoft.com") $sHTML = _IEDocReadHTML ($oIE) MsgBox(0, "Document Source", $sHTML) That just returns a "0"... and I'm sure that used to work. I have a script I used for ages that's very similar to that and it worked and now returns zeros. I thought it was the site I was accessing that changed, but any URL does the same. It returns the zero immediately, so I put in a sleep: #include <IE.au3> $oIE = _IECreate ("http://www.microsoft.com") sleep (500) $sHTML = _IEDocReadHTML ($oIE) MsgBox(0, "Document Source", $sHTML) And it fails with this error: C:\Program Files\AutoIt3\Include\IE.au3 (2021) : ==> The requested action with this object has failed.: Return SetError($_IEStatus_Success, 0, $o_object.document.documentElement.outerHTML) Return SetError($_IEStatus_Success, 0, $o_object.document^ ERROR Link to comment Share on other sites More sharing options...
water Posted December 31, 2010 Share Posted December 31, 2010 That works... but now instead of _IE_Example, let's use this: #include <IE.au3> $oIE = _IECreate ("http://www.microsoft.com") $sHTML = _IEDocReadHTML ($oIE) MsgBox(0, "Document Source", $sHTML)AutoIt is still alive and fine Maybe some problems with your proxy? Insert some error checking code and see what _IECreate or _IEDocHTML return? _IECretea returns an object. So insert MsgBox(0,"",isObj($oIE) & " " & @error)If everything is fine then you get "1 0". My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
LondonNDIB Posted December 31, 2010 Author Share Posted December 31, 2010 Thanks. In the meantime, I found out it works if I use #RequireAdmin... which I didn't have to do before. So "AutoIt is still alive and fine"... then how come no releases (even beta) since April? Is it that stable now that no bugs or anything had to be fixed? Or am I missing where the beta is now? Link to comment Share on other sites More sharing options...
LondonNDIB Posted December 31, 2010 Author Share Posted December 31, 2010 It returned "1 0" with and without #RequireAdmin Link to comment Share on other sites More sharing options...
water Posted December 31, 2010 Share Posted December 31, 2010 No new beta since april. There was a discussion on the forum a few weeks ago about this subject. The Devs replied that a new version will be released as soon as development has finished Version 3.3.6.1 is the most current release. If the _IE* functions don't work then usually your setup is the problem. Did you change the operating system since you last used Autoit? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
LondonNDIB Posted December 31, 2010 Author Share Posted December 31, 2010 No, nothing deliberately changed since that script last functioned correctly. I use it for a task I perform once per calendar month. I last did it Nov 2nd and I tried at the beginning of Dec and had a problem but I didn't really look into it until today. Probably something with an IE update or security. I'll figure it out. Thanks. Link to comment Share on other sites More sharing options...
ALFJ Posted January 1, 2011 Share Posted January 1, 2011 (edited) expandcollapse popup#include <IE.au3> ;-------- Main AUTOIT Declarations for this script -------------------- Opt("MustDeclareVars", 1) ;0=Not Required 1=Must declare ; ------- Broswer creation varibles for simplicity only---------------- Local $oIE, $GUIActiveX Local $gTitle = "My Browser" Local $gWidth = (@DesktopWidth-6); Local $gHeight = (@DesktopHeight-39);@DesktopHeight-39) ;for normal Local $SHTML GUICreate($gTitle,$gWidth,$gHeight,0,0, _ ; Create the GUI that will hold the embedded IE Explorer shell 0x04000000 + 0x02000000 + 0x10000000); _IE_AllowActiveX(True) ; Optional values, note this will also effect your IE in your pc even though it's using the explorer shell _IE_DisplayImages(True) _IE_DisplayVideos(True) _IE_PlayBackgroundSounds(True) _IE_PlayAnimations(True) _IEErrorHandlerRegister() _IEErrorNotify(True) _CreateShellIE() ;not the same IE included in Autoit, This uses the Explorer shell ;So it works even if I have IE9 or Windows 7 installed on my pc $oIE.Navigate("www.microsoft.com","","","","") ;navigate to this page Sleep(10000) ;Must use a delay to wait for IE to get the website otherwise the code crashes Local $sHTML $sHTML = _IEDocReadHTML ($oIE) MsgBox(0, "Document Source", $sHTML) ;ConsoleWrite($s_html & @LF) ;$oIE.document.Write($s_html) ;$oIE.refresh Func _CreateShellIE() $oIE = 0 $GUIActiveX = 0 While isObj($oIE) = 0 If IsObj($oIE) = 0 Then $oIE = ObjCreate("Shell.Explorer.2") ;works with Windows 7, XP regardless of what IE version you have ;If IsObj($oIE) = 0 Then $oIE = ObjCreate("InternetExplorer.Application");Fails on some websites depending on the version of IE you have Sleep(500) WEnd If Not IsObj($oIE) = 0 Then GuiCtrlCreateObj($oIE, (0 -1),(0 -1),($gWidth - 3),($gHeight - 8)) sleep(500) With $oIE ;Optional values will not effect your IE, will only effect this session .Silent = True ;Dialog boxes are not displayed .StatusBar = True ;Hidden Status bar .ToolBar = True ;Hidden Toolbar .MenuBar = True ;Hidden .AddressBar = True ; Hidden EndWith EndFunc ;==> _CreateIE ; ----------------------------------------------------------------------------------------------- Func _IE_DisplayImages($ivState); Applies to Current User Local $svKeyPath = "HKCU\SOFTWARE\Microsoft\Internet Explorer\Main" If $ivState Then RegWrite($svKeyPath, "Display Inline Images", "REG_SZ", "yes") Else RegWrite($svKeyPath, "Display Inline Images", "REG_SZ", "no") EndIf EndFunc;==>_IE_DisplayImages ; ----------------------------------------------------------------------------------------------- Func _IE_DisplayVideos($ivState) ; Applies to Current User Local $svKeyPath = "HKCU\SOFTWARE\Microsoft\Internet Explorer\Main" If $ivState Then RegWrite($svKeyPath, "Display Inline Videos", "REG_SZ", "yes") Else RegWrite($svKeyPath, "Display Inline Videos", "REG_SZ", "no") EndIf EndFunc ;==>_IE_DisplayVideos ; ----------------------------------------------------------------------------------------------- Func _IE_PlayBackgroundSounds($ivState) ; Applies to Current User Local $svKeyPath = "HKCU\SOFTWARE\Microsoft\Internet Explorer\Main" If $ivState Then RegWrite($svKeyPath, "Play_Background_Sounds", "REG_SZ", "yes") Else RegWrite($svKeyPath, "Play_Background_Sounds", "REG_SZ", "no") EndIf EndFunc ;==>_IE_PlayBackgroundSounds ; ----------------------------------------------------------------------------------------------- Func _IE_PlayAnimations($ivState) ; Applies to Current User Local $svKeyPath = "HKCU\SOFTWARE\Microsoft\Internet Explorer\Main" If $ivState Then RegWrite($svKeyPath, "Play_Animations", "REG_SZ", "yes") Else RegWrite($svKeyPath, "Play_Animations", "REG_SZ", "no") EndIf EndFunc ;==> _IE_PlayAnimations ; ----------------------------------------------------------------------------------------------- Func _IE_AllowActiveX($ivState) ; only applies to Internet Zone in Windows Local $svKeyPath = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3" If $ivState Then RegWrite($svKeyPath, "1200", "REG_DWORD", 0) Else RegWrite($svKeyPath, "1200", "REG_DWORD", 3) EndIf EndFunc ;==> _IE_AllowActiveX Try using the Embedded Explorer shell (example provided) this is non-dependent on which version of IE you have, It worked with Windows XP, Windows 7, regardless of which IE I have. Many other options provided.. such as hiding images, disabling AciveX, disabling the address bar etc.. so the page loads faster, be warned that you need to set a Sleep of at least (5000) after every navigate, since you need the page to load before you retrieve anything from the document if the delay is too low it will fail. Edited January 1, 2011 by ALFJ Link to comment Share on other sites More sharing options...
Zedna Posted January 1, 2011 Share Posted January 1, 2011 This is most probably problem in (changed) security settings in IE. It restricts your script to attempt properties/functions inside IE. I had similar problem on newly installed computer where we moved my utility using IE UDF. Finally I added URL address into trusted zone and it worked again. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Zedna Posted January 1, 2011 Share Posted January 1, 2011 (edited) So did AutoIt's development stop at some point? I see the forum is still active.Yes. There were some problems in dev comunity but it seems problems are not everlastingso we all hope this year will be better ... Edited January 1, 2011 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
DaleHohm Posted January 1, 2011 Share Posted January 1, 2011 Since #Require_Admin resolved your issues, I'll guess taht you may be running Vista with the default browser version. If so, see my sig for discussion and fixes caused by stupid security choices Microsoft made in that single combination. There are no general problems with IE.au3. 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...
LondonNDIB Posted January 1, 2011 Author Share Posted January 1, 2011 No, its Win 7. Thanks all. Zedna was bang on. ALFJ - that looks interesting! Too bad it can't detect when the page is completely loaded though. Guessing at 5s isn't very reliable. But I'll take a look Thanks! Happy new Year everyone!! Link to comment Share on other sites More sharing options...
ALFJ Posted January 1, 2011 Share Posted January 1, 2011 (edited) ALFJ - that looks interesting! Too bad it can't detect when the page is completely loaded though. Guessing at 5s isn't very reliable. But I'll take a look Well you could incorporate a wait delay on this as well, for my needs setting a pre-determined time I was willing to wait regardless of what I got worked better than waiting for the page to load and if it failed loading after a certain amount of time then either retry or skip it. Example $oIE.Navigate("http://www.yahoo.com","","","","") Local $TimeToWait = 0 While $oIE.ReadyState <> 4 Sleep(50) If $TimeToWait > 10000 Then Consolewrite("Failed to load the page in the Max allowed time to wait") Exitloop Else $TimeToWait = $TimeToWait + 50 EndIf WEnd You can also use Dale's Pre-made IE functions Included in the IE.au3, they also work with the $oIE shell object created, how ever I have not tested all of them, so if you do use one and it fails well someone in forum can probably tell you why. Dale has put more into the error handling, he has many nice functions, just remember to include the IE.au3 if you use any of the functions in there thought Example: $oIE.Navigate("http://www.yahoo.com","","","","") _IELoadWait($oIE) For what I use it for though using page wait delays instead of waiting for the page to load works better since some pages I don't care if it finishes loading, while others it's essential that it fully loads. It all depends on your needs. BTW codes up there have not been tested by me and might not be perfect but it gives you the idea if I missed something in them Good luck and Happy New Year!! Edited January 1, 2011 by ALFJ 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