Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ComboConstants.au3>
- #include <EditConstants.au3>
- #include <GUIConstantsEx.au3>
- #include <WindowsConstants.au3>
- #include <AD.au3>
- #include <Array.au3>
- ; Open Connection to the Active Directory
- _AD_Open()
- If @error Then Exit MsgBox(16, "Active Directory Example Skript", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended)
- ; Get FQDN for the currently logged on user
- Global $sFQDN = _AD_SamAccountNameToFQDN()
- ; Strip off the CN
- Global $iPos = StringInStr($sFQDN, ",")
- Global $sOU = StringMid($sFQDN, $iPos + 1)
- Global $aObjects[1][1]
- $aObjects = _AD_GetObjectsInOU($sOU, "(name=*)", 2, "sAMAccountName,distinguishedName,displayname")
- If @error > 0 Then
- MsgBox(64, "Active Directory Functions - Example 1", "No OUs could be found")
- Else
- ;~ _ArrayDisplay($aObjects, "Active Directory Functions - Example 1 - Objects in OU ' " & $sOU & "'")
- ;~ MsgBox (0, "1111", $aObjects[77][0])
- ;~ $iUbound = UBound ($aObjects, 1)
- ;~ MsgBox(64, '1', $iUbound)
- Local $iRows = UBound($aObjects, 1) ; Обще количество строк.
- Local $iCols = UBound($aObjects, 2) ; Обще количество колонок.
- Local $iDimension = UBound($aObjects, 0) ; Размерность массива, к примеру 1/2/3 -мерный.
- ;~ MsgBox(4096, "", "Массив " & $iDimension & '-мерный' & @CRLF & _
- ;~ 'с количеством строк ' & $iRows & @CRLF & _
- ;~ 'с количеством колонок: ' & $iCols)
- ;~ _ArrayDisplay($aObjects, "Active Directory Functions - Example 1 - Objects in OU ' " & $sOU & "'")
- Local $avArray[$iRows]
- ReDim $aObjects[$iRows][1]
- ;~ _ArrayDisplay($aObjects, "Массив после ReDim")
- Local $iDimension = UBound($aObjects, 0) ; Размерность массива, к примеру 1/2/3 -мерный.
- MsgBox(4096, "", "Массив " & $iDimension & '-мерный' )
- $aNewArray = _ArrayUnique($aObjects) ; Используются параметры по умолчанию
- ;~ _ArrayDisplay($aNewArray, "")
- ;~ _ArrayDelete($aNewArray, 0)
- ;~ _ArrayDelete($aNewArray, 0)
- ;~ $iRows2 = UBound($aNewArray, 1)
- ;~ MsgBox(0,'',$iRows2)
- ;~ _ArrayDelete($aNewArray, $iRows2-1)
- ;~ MsgBox(0,'',$iRows2)
- For $i = 1 To UBound($aNewArray) - 1
- If $aNewArray[$i] = "" Then
- ReDim $aNewArray[$i]
- ExitLoop
- EndIf
- Next
- _ArrayDisplay($aNewArray, "$aNewArray возвращает первую размерность массива $aArray")
- EndIf
- #Region ### START Koda GUI section ### Form=
- $Form1 = GUICreate("Form1", 615, 438, 192, 124)
- $Combo1 = GUICtrlCreateCombo("Combo1", 96, 32, 337, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
- GUICtrlSetData(-1, "www|eee|rrr|ttt")
- $Input1 = GUICtrlCreateInput("Input1", 96, 64, 337, 21)
- $Edit1 = GUICtrlCreateEdit("", 96, 88, 345, 49)
- GUICtrlSetData(-1, "Edit1")
- $Edit2 = GUICtrlCreateEdit("", 96, 144, 345, 233)
- GUICtrlSetData(-1, "Edit2")
- GUISetState(@SW_SHOW)
- #EndRegion ### END Koda GUI section ###
- While 1
- $nMsg = GUIGetMsg()
- Switch $nMsg
- Case $GUI_EVENT_CLOSE
- Exit
- EndSwitch
- WEnd
- ;~ $sResult = _AD_GetObjectAttribute($sOU, "Description")
- ;~ $sMail = _AD_GetObjectAttribute($sUser, "mail")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement