Sign in to follow this  
Followers 0
icu

Do array cells have a max string length? [solved]

3 posts in this topic

#1 ·  Posted (edited)

Dear AutoIt Community,

I've been stuck on a script for a few weeks now trying to figure out what the heck I'm doing wrong.

I can't put all the code here as it relates to an internal system at work but the gist of it is that I'm getting errors when a read an IE table into an array cell and then try to convert that array cell into a string so I can use regular expressions to sort the string into variables.

At first I thought I wasn't attaching to the right popup IE window. No, the following code confirmed AutoIt found it:

If WinExists ($sPopup_Window_Title) Then
    MsgBox (0, "", "Window exists")
EndIf

Then I wasn't sure if the array had the right information. No, the following code showed that the information was in array cell [0] with _ArrayDisplay:

$oPopup_Table = _IETableGetCollection ($oAPI_Popup_IE, 1) ; Table 1 is the table that has all the text I want
    If @error > 0 Then
    ConsoleWrite ("Error: " & @error & @CRLF)
EndIf

$aPopup_Table_Data = _IETableWriteToArray ($oPopup_Table)
_ArrayDisplay ($aPopup_Table_Data) ; Debug the array data
$sAPI_Info = _ArrayToString ($aPopup_Table_Data)
            
If @error > 0 Then
    ConsoleWrite ("Error: " & @error & @CRLF)
EndIf
            
ConsoleWrite ("API: " & $sAPI_Info & @CRLF)

The above code displays the following errors:

--> IE.au3 V2.4-0 Warning from function _IETableGetCollection, $_IEStatus_NoMatch

Error: 7

--> IE.au3 V2.4-0 Error from function _IETableWriteToArray, $_IEStatus_InvalidDataType

Error: 1

The Error 7 in IE.au3 is listed on line 1837 as:

;   - 7 ($_IEStatus_NoMatch) = No Match

...and Error 1 in IE.au3 is listed on line 1772 as:

;   - 3 ($_IEStatus_InvalidDataType) = Invalid Data Type

So why does AutoIt show the info I want in the _ArrayDisplay but I can't turn it into a string?

Perhaps the string is too long or is it something else I don't know about?

Thanks to all who reply,

-icu

Edited by icu

Share this post


Link to post
Share on other sites



1. Tables start at 0 ( zero ). So table 1 would be table 0 for the IE.au3 _IETableGetCollection

2. _IETableWriteToArray returns a 2 dimensional array.

3. _ArrayToString only works with 1 dimensional arrays.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

@SmOke_N: Thank you, thank you, thank you! I've been ripping my hair out. Your insightful quote:

2. _IETableWriteToArray returns a 2 dimensional array.

3. _ArrayToString only works with 1 dimensional arrays.

...made me understand why my code wasn't working. I then remembered

I used _ArrayToString2D and the string was ripped out of the array perfectly.

Kind regards,

icu

Edited by icu

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  
Followers 0