Jump to content

[Solved] Problem with array


realtebo
 Share

Go to solution Solved by jdelaney,

Recommended Posts

I'm not albe to understand how to handle Array.

I need a DYNAMIC array, because I've not idea of how mouch data i'll include in it.

and every 'row' of the array must have 2 elements;

So i've

Global $confirmed_po_links[0][0]

and in the function when this is populated. ...

Local $new_size     = UBound($confirmed_po_links) + 1;
ReDim $confirmed_po_links[$new_size][2];
$confirmed_po_links[$new_size][1] = $link.innerText;  **** THE ERROR HAPPENS HERE ***
$confirmed_po_links[$new_size][2] = $link.href

But I got some errors about array dimensions... why? in the row with the asterisks

 


Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

Edited by realtebo
Link to comment
Share on other sites

Local $new_size     = UBound($confirmed_po_links) + 1;
ReDim $confirmed_po_links[$new_size][2];
$confirmed_po_links[$new_size-1][1] = $link.innerText;  **** THE ERROR HAPPENS HERE (no longer!) ***
$confirmed_po_links[$new_size-1][2] = $link.href])

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Shouldn't it be like this (2nd dimension goes from 0 to 1):

Local $new_size = UBound($confirmed_po_links) + 1
ReDim $confirmed_po_links[$new_size][2]
$confirmed_po_links[$new_size-1][0] = $link.innerText
$confirmed_po_links[$new_size-1][1] = $link.href)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Solution

Oops, didn't even see that error.

Note to OP, you should post a script that's reproducible (what you provided is not) if you want all corrections fixed on the first go around.

Like this:

#include <Array.au3>
Local $confirmed_po_links[1][2]=[["testa","test1"]]
_ArrayDisplay($confirmed_po_links,"before")
ReDim $confirmed_po_links[UBound($confirmed_po_links)+1][2]
$confirmed_po_links[UBound($confirmed_po_links)-1][0] = "testb"
$confirmed_po_links[UBound($confirmed_po_links)-1][1] = "test2"
_ArrayDisplay($confirmed_po_links,"after")
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
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...