Jump to content

Recommended Posts

Posted

What's wrong with this Function calling?

$member = "someone"


_ADGetGroupMembers($member, "Standard")

Func _ADGetGroupMembers(ByRef $members, $groupdn, $sort = 0)

I get this error:

ERROR: _ADGetGroupMembers() already defined.

Func _ADGetGroupMembers(ByRef $members, $groupdn, $sort = 0)

Posted

thats kinda weird... the _ADGetGroupMembers function doesnt conflict with any internal functions that i know of...

oh and to answer your question.. you only defined the name of the function not what it does.. or where it ends. but why your getting the error, you may have already created that function somewhere else in your script no way to tell till we can see it.

A great place to start Autoit 1-2-3

Posted

The reason was that I included adfunctions.au3 and also copied one function.

but now I get another error.

this is my code:

#include "adfunctions.au3"


$member = "someone"


_ADGetGroupMembers($member, "Standard")

this is the error:

C:\Program Files\AutoIt3\Include\adfunctions.au3 (418) : ==> Object referenced outside a "With" statement.:

$membersadd = $objRecordSet.fields (0).Value

$membersadd = $objRecordSet.fields (0)^ ERROR

Posted

The code in the included looks like this:

Func _ADGetGroupMembers(ByRef $members, $groupdn, $sort = 0)
;If _ADObjectExists($group) = 0 Then Return 0
    
    Local $oUsr, $objCommand, $groups

    $objCommand = ObjCreate("ADODB.Command")
    $objCommand.ActiveConnection = $objConnection
    $objCommand.Properties ("Searchscope") = 2

    Dim $members[1]
    $i = 0

    While 1
        $rangemodifier = $i * 1000
        $range = "Range=" & $rangemodifier & "-" & $rangemodifier + 999
        $strCmdText = "<LDAP://" & $strHostServer & "/" & $groupdn & ">;;member;" & $range & ";base"
        $objCommand.CommandText = $strCmdText
        $objRecordSet = $objCommand.Execute
        $membersadd = $objRecordSet.fields (0).Value
        If $membersadd = 0 Then ExitLoop
        ReDim $members[UBound($members) + 1000]
        For $j = $rangemodifier + 1 To $rangemodifier + 1000
            $members[$j] = $membersadd[$j - $rangemodifier - 1]
        Next
        $i += 1
        $objRecordSet.Close
    WEnd

    $rangemodifier = $i * 1000
    $range = "Range=" & $rangemodifier & "-*"
    $strCmdText = "<LDAP://" & $strHostServer & "/" & $groupdn & ">;;member;" & $range & ";base"
    $objCommand.CommandText = $strCmdText
    $objRecordSet = $objCommand.Execute
    $membersadd = $objRecordSet.fields (0).Value

    ReDim $members[UBound($members) + UBound($membersadd) ]

    For $j = $rangemodifier + 1 To $rangemodifier + UBound($membersadd)
        $members[$j] = $membersadd[$j - $rangemodifier - 1]
    Next

    $objRecordSet.Close
    
    $objCommand = 0
    $objRecordSet = 0
    
    $members[0] = UBound($members) - 1
    
    If $sort = 1 Then
        _ArraySort($members, 0, 1)
    EndIf
    
    Return 1
EndFunc  ;==>_ADGetGroupMembers

Posted
  Quote

this is the error:

I get many other errors, due to undeclared variables. Please post working code.

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted

  MrCreatoR said:

I get many other errors, due to undeclared variables. Please post working code.

Make sure you have the the newest version of autoit, also i think that you may need autoit beta as well.

Cheers

Ashww

X)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Projects: Account Control Wii style gui Bingo Caller - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Want a website? Click here!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -I use my Blackberry Storm to browse the forum! Please be patient!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Posted (edited)

  Ashww said:

Make sure you have the the newest version of autoit, also i think that you may need autoit beta as well.

Cheers

Ashww

X)

Make sure to look at my signature, i do use latest version, but how is that suppose to avoid the error with undeclared variables, these are user's variables. Edited by MrCreatoR

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted (edited)
  Quote

you need the adfunctions.au3 library.

It's addressed to me? Then no, i don't. It's you ho need to provide at least a link on that library :), but better as i said, a working example. Edited by MrCreatoR

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted

Here is the link to the ad library: http://www.autoitscript.com/forum/index.ph...amp;showfile=66

What do you mean with "working code"? The code isn't working, that's the problem.

Do you want me to copy&paste all the functions i use into my code?

Posted
  Quote

What do you mean with "working code"?

I mean that i will be able to run it without any other errors except the mentioned by you.

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...