Brenda1 Posted April 25, 2008 Share Posted April 25, 2008 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 More sharing options...
monoceres Posted April 25, 2008 Share Posted April 25, 2008 Check out _ArrayAdd in the helpfile Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
YellowLab Posted April 25, 2008 Share Posted April 25, 2008 (edited) 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 Edited April 25, 2008 by YellowLab You can't see a rainbow without first experiencing the rain. Link to comment Share on other sites More sharing options...
Brenda1 Posted April 25, 2008 Author Share Posted April 25, 2008 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 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 More sharing options...
Richard Robertson Posted April 25, 2008 Share Posted April 25, 2008 You declared $aArray as an array beforehand, right? You know, "Dim $aArray[0]"? Link to comment Share on other sites More sharing options...
Brenda1 Posted April 29, 2008 Author Share Posted April 29, 2008 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 More sharing options...
PsaltyDS Posted April 29, 2008 Share Posted April 29, 2008 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> 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 More sharing options...
Richard Robertson Posted April 29, 2008 Share Posted April 29, 2008 Why can't you declare a 0 length array? I thought that was allowed. Link to comment Share on other sites More sharing options...
Squirrely1 Posted April 29, 2008 Share Posted April 29, 2008 Why can't you declare a 0 length array? I thought that was allowed.I noticed just yesterday that SciTe issues a warning when you do this: "Warning - array badly formed". Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
Richard Robertson Posted April 29, 2008 Share Posted April 29, 2008 Huh, well that's something I didn't know. I'm just used to being able to declare 0 length arrays in other languages then probably. Link to comment Share on other sites More sharing options...
Brenda1 Posted April 30, 2008 Author Share Posted April 30, 2008 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> 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now