Jump to content
Sign in to follow this  
goldenix

Help with Assign function

Recommended Posts

goldenix

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]

Share this post


Link to post
Share on other sites
jdelaney

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.

Share this post


Link to post
Share on other sites
goldenix

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]

Share this post


Link to post
Share on other sites
guinness

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

  • Like 1

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

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  

×