kID_kORN Posted March 29, 2018 Share Posted March 29, 2018 Hello everybody! I'm new here and a newbie working with AutoIt. I have some legacy code using AutoIt that is having some problems and I'm having some trouble resolving them. The code is trying to save a webpage's HTML to a text file. It was working perfectly for months but, all of a sudden, the file where the HTML is stored just contains a "0". I was searching some help and found this topic with the same error but it looks like some messages have been deleted and I don't have enough info to get to resolve my problem: Here is the code: _IENavigate($oTruco2,) Local $hFileOpen = FileOpen($sTempFolder&"\webpage_"&$idProy&".txt", $FO_OVERWRITE) FileWrite($hFileOpen,_IEBodyReadHTML($oTruco2)) IniWriteSection($sFilePath&"webpages_avan.ini","Proyecto"&$i,$sTempFolder&"\webpage_"&$idProy&".txt") FileClose($hFileOpen) _IEQuit($oTruco2); If someone can lend me a hand, I'll be really grateful. Link to comment Share on other sites More sharing options...
Danp2 Posted March 29, 2018 Share Posted March 29, 2018 @kID_kORN Welcome to the forum! Nice to see a "newbie" that does some research before blindly asking for help. A couple of thoughts related to your situation -- Separate the commands and add some error checking. For example -- $sHTML = _IEBodyReadHTML($oTruco2) If Not @error Then FileWrite($hFileOpen, $sHTML) This will prevent the "0" from being written to the file. You would need to investigate the value of @error to determine why _IEBodyReadHTML is failing. Depending on your needs, you could drop the _IE* command and use something like _INetGetSource instead. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
kID_kORN Posted March 29, 2018 Author Share Posted March 29, 2018 Thanks Danp2! I have added error checking and I'm trying to determine what is error value 3. I'm going to consult @extended value too to try to understand the problem... Link to comment Share on other sites More sharing options...
Danp2 Posted March 29, 2018 Share Posted March 29, 2018 @kID_kORN Looking at the code for _IEBodyReadHTML, it would return an error code of 3 when you pass a bad parameter (non-object) to the function. Latest Webdriver UDF Release Webdriver Wiki FAQs 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