Jump to content

create an array


Recommended Posts

Hello Guys, is friday and I am complety lost! I need to put some information in one array (yes I know, as simple as that) this is my code:

$groups = $oUsr.groups  
    $tempbis = $oUsr.memberof
    
    For $groupname In $groups
        $test= $groupname.distinguishedname;this is what I want to put in the array
                                 $array= $array + $test
    Next

this is not working and I just want to use a simple array to get this information stored. Heeeeelp

Link to comment
Share on other sites

Not being familiar with the data structure you are trying to add to the array, you may want to check out the UDF Array functions:

_ArrayAdd

_ArrayInsert

may be what you are looking for.

Bob

EDIT: what monoceres said :D

Edited by YellowLab

You can't see a rainbow without first experiencing the rain.

Link to comment
Share on other sites

Not being familiar with the data structure you are trying to add to the array, you may want to check out the UDF Array functions:

_ArrayAdd

_ArrayInsert

may be what you are looking for.

Bob

EDIT: what monoceres said :D

what I am getting with:

$test= $groupname.distinguishedname

is something like: "$test=Group;type;rights;servers" but one account can have many groups, thats why I want to store them in one array, I try to put this:

For $groupname In $groups
     $test= $groupname.distinguishedname
     _ArrayAdd($aArray,$test)
        
Next

but didn't wooork!!!! =(

Link to comment
Share on other sites

You declared $aArray as an array beforehand, right? You know, "Dim $aArray[0]"?

yes I declared the array like this:

dim $aArray[0]
    $groups = $oUsr.groups 
    $tempbis = $oUsr.memberof
    
    For $groupname In $groups
        $test= $groupname.distinguishedname
        _ArrayAdd($aArray,$test)
    Next

and I got this error:

test.au3(24,26) : ERROR: _ArrayAdd(): undefined function.
        _ArrayAdd($aArray,$test)
        ~~~~~~~~~~~~~~~~~~~~~~~^

what I am doing is getting information for some accounts, I need to know which account belong to diferents "groups", with "$test= $groupname.distinguishedname" I get the info for just one group, but the accoun have differents groups, that is what I want to storage in the array, all the groups of each account.

Help me guys I don't know what is wrong

Link to comment
Share on other sites

yes I declared the array like this:

dim $aArray[0]
    $groups = $oUsr.groups 
    $tempbis = $oUsr.memberof
    
    For $groupname In $groups
        $test= $groupname.distinguishedname
        _ArrayAdd($aArray,$test)
    Next

and I got this error:

test.au3(24,26) : ERROR: _ArrayAdd(): undefined function.
        _ArrayAdd($aArray,$test)
        ~~~~~~~~~~~~~~~~~~~~~~~^

what I am doing is getting information for some accounts, I need to know which account belong to diferents "groups", with "$test= $groupname.distinguishedname" I get the info for just one group, but the accoun have differents groups, that is what I want to storage in the array, all the groups of each account.

Help me guys I don't know what is wrong

Two points:

1. You don't declare an array with 0 elements, so use Global $aArray[1] to declare it.

2. The _ArrayAdd() function is a User Defined Function (UDF) included in the Array.au3 file, so add this to the top of your script: #include <Array.au3>

:D

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
Link to comment
Share on other sites

Two points:

1. You don't declare an array with 0 elements, so use Global $aArray[1] to declare it.

2. The _ArrayAdd() function is a User Defined Function (UDF) included in the Array.au3 file, so add this to the top of your script: #include <Array.au3>

:D

thank you so much for your help, I didn't know I coudn't declare arrays with 0 elements in autoIT, and yes the library was missing too. =)

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...