Jump to content

Help with arrays


Recommended Posts

im try to do some stuff with Active Directory, and i just found the AD UDF's and have been playing with them, anyway, everthing is listed to an array be it 1D or 2D. i want to extract specific values from this array

#include<AD.au3>
#include<Array.au3>

_AD_Open()

$adObj = _AD_GetObjectProperties()

_AD_Close()

now, i want the "Department" fields value, which in the user i am running this under is $iIndex = 9 but i don't want the index, or Col 1 value, i want Col 2 value, the actual comapany name.

i have tried this

MsgBox(0, '', $adObj[9])

but of course that doesn't work. im not sure how to manipulate this 2D array. and i didn't find a function under the _ArrayManagement UDF's.

thanks for any help.

Link to comment
Share on other sites

thanks for you help, exodius, and i know about the _ArrayDisplay($iArray), and the second example you put doesn't work, atleast not in a MsgBox, as i stated in my original post, though it may if you do this

MsgBox(0, '', _ArrayToString($adObj, "|", 9, 9))

but i havent tried that

i did find i can do this:

#include<AD.au3>
#include<Array.au3>

_AD_Open()

$adObj = _AD_GetObjectProperties(@UserName, "department, displayName")

_AD_Close()

_ArrayDisplay($adObj)

so that gets me the specific values i need, i should have rtfm more closely haha, but i still need to work on just getting the Values, out of the array, thanks again!!

Edited by redLabel
Link to comment
Share on other sites

im not sure what the point is of 2D Array's, all the UDF's for _Array*() all return @error codes if its not a 1D array. so, i guess now that i have a way to get one specific item for AD, how do i pull that value from the 2D array, i can't use the _ArrayToString() UDF, im not sure what else i can do to get the value(s) i need.

Link to comment
Share on other sites

i can't believe how easy it was, and i apologize for being so ignorant

#include<AD.au3>
_AD_Open()

$adObj = _AD_GetObjectProperties(@UserName, "department")

_AD_Close()

MsgBox(0, "Current User Dept", $adObj[1][1])

i can't believe the answer was just two subscripts. i do with that there was some better documentation on how to use 2D Arrays. anyway, happy coding.

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