Jump to content

_IEBodyReadHTML returns 0


Recommended Posts

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

@kID_kORN Welcome to the forum! Nice to see a "newbie" that does some research before blindly asking for help. :thumbsup:

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.
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...