Jump to content
Sign in to follow this  
magicknite

IEtablewritetoArray & non-array variable error

Recommended Posts

magicknite

Been reading posts for long time and learned thru the help file and searching. But I'm stumped and can't find the answer to this one. Help please. I thought is was simple, but everything I've continues to fail. Program only runs on XP and up machines with IE6 or IE7.

The following is the beginning of a function that reads a webpage and captures the nested table and then writes it to a file for later viewing. The problem is that on some folks computers, AutoIt returns the a "subscript used with non-array variable" when it gets to the FileWriteLine with the $VOpentm2 variable.

Dim $oTable2,$VOpentm,$VOpentm2
    $VOTfile = FileOpen($Ipath & "\OpenTime.txt", 2) ;open file
    $oTable2 = _IETableGetCollection ($oIE, 7) ;get table from webpage
    $VOpentm = _IETableWriteToArray ($oTable2) ;write specific table to array
    $VOpentm2 = $VOpentm[1][1] ;array element for file write
    FileWriteLine($VOTfile, "Saved @ " & @YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN)
    FileWriteLine($VOTfile, $VOpentm2) ;writes open time variable to file
    FileClose($VOTfile)

Share this post


Link to post
Share on other sites
PsaltyDS

There is more info available from the _IETable* functions. For a temporary debug to see what's up:

Dim $oTable2, $VOpentm, $VOpentm2
$VOTfile = FileOpen($Ipath & "\OpenTime.txt", 2) ;open file
$oTable2 = _IETableGetCollection($oIE, 7) ;get table from webpage
If @error Then MsgBox(16, "Debug", "Error in _IETableGetCollection():" & @CRLF & "@error = " & @error & "  @extended = " & @extended)
$VOpentm = _IETableWriteToArray($oTable2) ;write specific table to array
If @error Then MsgBox(16, "Debug", "Error in _IETableWriteToArray():" & @CRLF & "@error = " & @error & "  @extended = " & @extended)
$VOpentm2 = $VOpentm[1][1] ;array element for file write
FileWriteLine($VOTfile, "Saved @ " & @YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN)
FileWriteLine($VOTfile, $VOpentm2) ;writes open time variable to file
FileClose($VOTfile)

Of course, instead of MsgBox(), you could use ConsoleWrite() or _FileWriteLog(), etc., to see the error details.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
magicknite

There is more info available from the _IETable* functions. For a temporary debug to see what's up:

:)

Yes, it would be a good idea to "see" what's going on in the background. Thanks for the capture code.

.

Share this post


Link to post
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
Sign in to follow this  

×