Necromorph Posted November 27, 2010 Posted November 27, 2010 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.
exodius Posted November 27, 2010 Posted November 27, 2010 Try this to see the entirety of your array: _ArrayDisplay($adObj) And try this to see the one element you want (you'll need to change the #'s): MsgBox(0, '', $adObj[3][9])
Necromorph Posted November 27, 2010 Author Posted November 27, 2010 (edited) 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 November 27, 2010 by redLabel
Necromorph Posted November 27, 2010 Author Posted November 27, 2010 Nevermind about the MsgBox(0, '', _ArrayToString($adObj, "|", 9, 9)) you cannot use the _ArrayToString() UDF on a 2D Array, 1D only, that is why the MsgBox() doesnt work.
Necromorph Posted November 27, 2010 Author Posted November 27, 2010 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.
Necromorph Posted November 27, 2010 Author Posted November 27, 2010 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.
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