[..] Convertir le visualbasic en autoit
Posté : mer. 15 juin 2011 15:45
par richie6700
Bonjour,
Serait t-il possible de me convertir ce script en "autoit" :
Merci à vous
Serait t-il possible de me convertir ce script en "autoit" :
► Afficher le texteVBS
option explicit
Sub Get_LDAP_Data()
Dim con,rs,Com,strValue
dim i,strMember,strGroup
Set con = CreateObject("ADODB.Connection")
con.provider ="ADsDSOObject"
con.Properties("User ID") = "cn=UserID,o=AAA" ' specify your UserID and containter with AAA being the container
con.Properties("Password") = "Password" ' specify your password
con.open "Active Directory Provider"
Set Com = CreateObject("ADODB.Command")
Set Com.ActiveConnection = con
'You have to specify your LDAP server and the container in the following line
Com.CommandText ="select cn,member from 'LDAP://YourLdapServer.com/o=AAA' where objectClass = 'groupOfNames'"
Set rs = Com.Execute
strValue = "nds_group|&|member_id"
do until rs.eof
strGroup = rs("cn")
strMember = rs("member")
If isarray(strMember) then
for i=0 to ubound(strMember)
strValue = strValue & vbcrlf & strGroup(0) & "|&|" & Friendly_Context(strMember(i))
next
end if
rs.MoveNext
loop
wscript.echo strValue
rs.Close
con.Close
Set rs = Nothing
Set con = Nothing
End Sub
Function Friendly_Context(aryValue)
dim i,strValue,aryValue2
aryValue = split(aryValue,",")
For i=0 to ubound(aryValue)
aryValue2 = split(aryValue(i),"=")
if strValue = "" then
strValue = aryValue2(1)
else
strValue = strValue & "." & aryValue2(1)
end if
Next
Friendly_Context = strValue
End Function
call Get_LDAP_Data()
Sub Get_LDAP_Data()
Dim con,rs,Com,strValue
dim i,strMember,strGroup
Set con = CreateObject("ADODB.Connection")
con.provider ="ADsDSOObject"
con.Properties("User ID") = "cn=UserID,o=AAA" ' specify your UserID and containter with AAA being the container
con.Properties("Password") = "Password" ' specify your password
con.open "Active Directory Provider"
Set Com = CreateObject("ADODB.Command")
Set Com.ActiveConnection = con
'You have to specify your LDAP server and the container in the following line
Com.CommandText ="select cn,member from 'LDAP://YourLdapServer.com/o=AAA' where objectClass = 'groupOfNames'"
Set rs = Com.Execute
strValue = "nds_group|&|member_id"
do until rs.eof
strGroup = rs("cn")
strMember = rs("member")
If isarray(strMember) then
for i=0 to ubound(strMember)
strValue = strValue & vbcrlf & strGroup(0) & "|&|" & Friendly_Context(strMember(i))
next
end if
rs.MoveNext
loop
wscript.echo strValue
rs.Close
con.Close
Set rs = Nothing
Set con = Nothing
End Sub
Function Friendly_Context(aryValue)
dim i,strValue,aryValue2
aryValue = split(aryValue,",")
For i=0 to ubound(aryValue)
aryValue2 = split(aryValue(i),"=")
if strValue = "" then
strValue = aryValue2(1)
else
strValue = strValue & "." & aryValue2(1)
end if
Next
Friendly_Context = strValue
End Function
call Get_LDAP_Data()