Jump to content

Why would _IECreate or _IEBodyReadHTML not work when a machine is locked?


gte
 Share

Recommended Posts

In testing, I've had this work twice to where it returns an empty html file and once where it returned the correct html file?

Here is my code, can these functions not work or read html when a machine is locked?

$ietext =_IECreate("http://server/folder/folder/Rotation/Current.aspx?View=%7BE25B5C98%2D352E%2D4818%2D8FF7%2D448F0B581C3C%7D&ShowInGrid=HTML" , 0, 1, 0, 0)
    Do
    ConsoleWrite("Opening web page" & @CRLF)
    
    Until WinExists("Shift Rotation", "Shift Rotation")



$ietext2 = _IEBodyReadHTML($ietext)
$ietext3 = StringReplace($ietext2, '</TD><TD Class="ms-vb2">', '</TD> &nbsp; <TD Class="ms-vb2">')

$saveschedulelocation = "\\serverlocation\schedule\schedule_" & $todaysdate & ".htm"

FileWrite($saveschedulelocation, $ietext3)
Link to comment
Share on other sites

That is what I had thought too, the reason I questioned/suggested it is because when it is saving the .htm file, it's cutting it off at about 40 lines of html, unless I put a sleep command in before the filewrite or consolewrite??

Your script will not continue until a function call completely returns. This means that for the rest of your script, it is irrelevant how long StringReplace takes.

Link to comment
Share on other sites

Are you saying to use IEDocReadHTML, cause I'm using body already.

Also, with the file write, I used a console write to compare, to eliminate network issues, and it did the same thing without that extra pause?

Maybe my do ... until for the webpage was failing/not loading in time? And the iewait will fix that?

That's definitely not the case.

It can also be the FileWrite command being cut off due to network issues.

- You can write the file locally first, then try to copy it to it's new location.

Or it can be because you used _IEBodyReadHTML instead of _IEDocReadHTML

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...