I'm a novice using COM support in AU3 ... so have mercy I'm using an ActiveX control from Novell Developers Kit supporting LDAP query. If I use the control with VBScript no problem; when I translate the script in AU3 the method returnig value(s) for an attribute of a searched object give non results. This is an OLEVIEW export of the method [id(0x00000004), propget, helpstring("Returns the requested field value"), helpcontext(0x00000026)] VARIANT FieldValue([in] BSTR FieldName); I think the problem is the VARIANT datatype. This is the fully functional VBScript Option Explicit
Dim oShell
Dim oNWQry
Dim oNWLst
Dim nOggetti
Dim oNWUsr
Dim aValori
'
Set oShell = WScript.CreateObject("WScript.Shell")
Set oNWQry = WScript.CreateObject("NWIDirQueryLib.NWIDirQuery.1.2")
oNWQry.FullName = "ldap://server/o=myorg/ou=myou1"
oNWQry.Filter = "(&(objectclass=inetOrgPerson)(|(surname=FO0233*)(uid=FO0233*)(cn=FO0233*)))"
oNWQry.Fields = "sn, givenName"
oNWQry.TimeLimit = 60
oNWQry.SearchScope = 2
oNWQry.MaximumResults = 20
oNWQry.SearchMode = 0
oNWQry.AutoReferral = 1
' LDAP Connect
oNWQry.Connect
' LDAP Search
Set oNWLst = oNWQry.Search
' goto 1st object Item(0)
Set oNWUsr=oNWLst.Item(0)
' show object shortname tipically cn=userid
oShell.Popup oNWUsr.ShortName
' value(s) for attribute "sn" in array aValori
aValori = oNWUsr.FieldValue("sn")
' show 1st value for attribute
oShell.Popup aValori(0)
' LDAP Disconnect
oNWQry.DisConnect
WScript.Quit The Autoit3 $oNWQry = ObjCreate("NWIDirQueryLib.NWIDirQuery.1.2")
$oNWQry.FullName = "ldap://server/o=myorg/ou=myou1"
$oNWQry.Filter = "(&(objectclass=inetOrgPerson)(|(surname=FO0233*)(uid=FO0233*)(cn=FO0233*)))"
$oNWQry.Fields = "sn, givenName"
$oNWQry.TimeLimit = 60
$oNWQry.SearchScope = 2
$oNWQry.MaximumResults = 20
$oNWQry.SearchMode = 0
$oNWQry.AutoReferral = 1
' LDAP Connect
$oNWQry.Connect
' LDAP Search
$oNWLst=$oNWQry.Search
' goto 1st object Item(0)
$oNWUsr=$oNWLst.Item(0)
' show object shortname tipically cn=userid
Msgbox(0,"",$oNWUsr.ShortName)
$aValori=$oNWUsr.FieldValue("sn")
' aValori is not an array, the variable is null Do you know if VARIANT datatype is supported for OLE/COM in Autoit3 or there is another error in my vbs->au3 porting. TIA Vincenzo