Jump to content

Help with Assign function


Go to solution Solved by jdelaney,

Recommended Posts

Posted

Hi

How can I create a list of arrays like $array1, $array2 etc...?

I made an example where I try to put an array inside another array. It works fine, but i dont understand how to create a variable name. So far all I tried does not work.

with regards

#include <array.au3>

Global $mainArray[3][2]                 ;Create an array with [3-rows][2-columns]

Global $arr

for $i = 0 to 2

    $arr = Assign('array' & $i, 0)

    $arr = $arr[2][3]

     $mainArray[$i][0] = $i
     $mainArray[$i][1] =  $arr      ;I would like to create a array hire for each row
Next

_ArrayDisplay( $array0 )
My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
  • Solution
Posted (edited)

If you are housing the data in an array, the name doesn't matter, only the subscript that houses it does:

#include <array.au3>

Global $mainArray[3][2]                 ;Create an array with [3-rows][2-columns]
Global $childArray[2][3]
Global $arr
for $i = 0 to UBound($mainArray)-1
    $mainArray[$i][0] = $i
    $mainArray[$i][1] = $childArray
Next

_ArrayDisplay($mainArray[0][1])





You can do something like this, but would need a temp variable to use _arraydisplay...which kind of defeats the purpose of the named array anyways

#include <array.au3>

Global $mainArray[3][2]                 ;Create an array with [3-rows][2-columns]
Global $childArray[2][3]
Global $arr
for $i = 0 to UBound($mainArray)-1
    $mainArray[$i][0] = $i
    Assign("array" & $i, $childArray)
    $aTemp = Eval("array" & $i)
    _ArrayDisplay($aTemp)
    $mainArray[$i][1] = $aTemp
Next

_ArrayDisplay($mainArray[0][1])
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.
Posted

im still a bit confused, must go & think it over, but this is what I basically want, yes.

Thank you

#include <array.au3>

Global $mainArray[3][2]                 ;Create an array with [3-rows][2-columns]
Global $childArray[2][3]

_ArrayDisplay($mainArray)

for $i = 0 to UBound($mainArray)-1
    ConsoleWrite($i & @CRLF)

    $mainArray[$i][0] = $i

    Assign("array" & $i, $childArray)

    $aTemp = Eval("array" & $i)

    if $i = 2 Then $aTemp[0][1] = 'xxx'

    $mainArray[$i][1] = $aTemp
Next

_ArrayDisplay($mainArray[2][1])
My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Posted

With great power, comes great responsibility. Don't abuse these functions, which is being done here.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

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
  • Recently Browsing   0 members

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