Jump to content
Sign in to follow this  
Praxi

How to pass arguments to UDF?

Recommended Posts

Praxi

Trying to figure out how to do this with adfunctions.au3. I've read through the documentation, but not following it very well. Basically with the following code, it does not work, unless I go change adfunctions.au3 itself. Talking about the $datatoretrieve bit here. It never seems to pass it, and my understanding of how that works is pretty shakey. I'm sure I'm doing that wrong, but thats what I get to work. I would like to learn the right way to do it.

;=============================================================================
;       AUTOIT RUNTIME OPTIONS
;=============================================================================
;Opt("Runerrorsfatal",0)
Opt("Traymenumode", 1)
Opt("Trayicondebug", 1)
Opt("ExpandENVStrings", 1)
Opt("ExpandVARStrings", 1)
;=============================================================================
;       Includes
;=============================================================================
#include <adfunctions.au3>
#include <array.au3>
#include <file.au3>
;=============================================================================
;       GLOBAL VARIABLES
;=============================================================================
Dim $OUUSERS, $user_array
Dim $GWDUMPFILE = "i:\projects\ldap cleanup\ndsreport.txt",$ou = "OU=OEDStaff,DC=OED,DC=LOCAL",$datatoretrieve = "sAMAccountName,mail",$email
;=============================================================================
;       MAIN
;=============================================================================
ConsoleWrite(@CRLF & @CRLF)
_FileReadToArray($GWDUMPFILE, $user_array)
;_ArrayDisplay($user_array,"Text File Array")
_ADGetObjectsInOU($OUUSERS, $ou, $datatoretrieve)

If I change the variable listed in adfunctions.au3 itself it seems to work fine.

Func _ADGetObjectsInOU(ByRef $ObjectArray, $ou, $filter = "(objectclass=user)", $searchscope = 2, $datatoretrieve = "sAMAccountName,telephonenumber", $sortby = "sAMAccountName")

I've tried searching the forums, but not having a lot of luck due to too many 3 letter words.

Help me Obi Won Kenobi's your my only hope.

Share this post


Link to post
Share on other sites
Zedna

...
$data = "sAMAccountName,telephonenumber" 
_ADGetObjectsInOU($OUUSERS, $ou, $data)

Func _ADGetObjectsInOU(ByRef $ObjectArray, $ou, $filter = "(objectclass=user)", $searchscope = 2, $datatoretrieve = "", $sortby = "sAMAccountName")
...

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  

×