Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 3.11 KB | None | 0 0
  1. #include <ComboConstants.au3>
  2. #include <EditConstants.au3>
  3. #include <GUIConstantsEx.au3>
  4. #include <WindowsConstants.au3>
  5. #include <AD.au3>
  6. #include <Array.au3>
  7.  
  8. ; Open Connection to the Active Directory
  9. _AD_Open()
  10. If @error Then Exit MsgBox(16, "Active Directory Example Skript", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended)
  11.  
  12. ; Get FQDN for the currently logged on user
  13. Global $sFQDN = _AD_SamAccountNameToFQDN()
  14.  
  15. ; Strip off the CN
  16. Global $iPos = StringInStr($sFQDN, ",")
  17. Global $sOU = StringMid($sFQDN, $iPos + 1)
  18.  
  19. Global $aObjects[1][1]
  20.  
  21. $aObjects = _AD_GetObjectsInOU($sOU, "(name=*)", 2, "sAMAccountName,distinguishedName,displayname")
  22. If @error > 0 Then
  23.     MsgBox(64, "Active Directory Functions - Example 1", "No OUs could be found")
  24. Else
  25. ;~  _ArrayDisplay($aObjects, "Active Directory Functions - Example 1 - Objects in OU ' " & $sOU & "'")
  26.  
  27. ;~ MsgBox (0, "1111", $aObjects[77][0])
  28.  
  29.  
  30.  
  31. ;~ $iUbound = UBound ($aObjects, 1)
  32. ;~ MsgBox(64, '1', $iUbound)
  33.  
  34. Local $iRows = UBound($aObjects, 1) ; Обще количество строк.
  35. Local $iCols = UBound($aObjects, 2) ; Обще количество колонок.
  36. Local $iDimension = UBound($aObjects, 0) ; Размерность массива, к примеру 1/2/3 -мерный.
  37.  
  38. ;~ MsgBox(4096, "", "Массив " & $iDimension & '-мерный' & @CRLF & _
  39. ;~      'с количеством строк ' & $iRows & @CRLF & _
  40. ;~      'с количеством колонок: ' & $iCols)
  41.  
  42. ;~ _ArrayDisplay($aObjects, "Active Directory Functions - Example 1 - Objects in OU ' " & $sOU & "'")
  43. Local $avArray[$iRows]
  44.  
  45. ReDim $aObjects[$iRows][1]
  46. ;~ _ArrayDisplay($aObjects, "Массив после ReDim")
  47.  
  48. Local $iDimension = UBound($aObjects, 0) ; Размерность массива, к примеру 1/2/3 -мерный.
  49.  
  50. MsgBox(4096, "", "Массив " & $iDimension & '-мерный' )
  51. $aNewArray = _ArrayUnique($aObjects) ; Используются параметры по умолчанию
  52. ;~ _ArrayDisplay($aNewArray, "")
  53. ;~ _ArrayDelete($aNewArray, 0)
  54. ;~ _ArrayDelete($aNewArray, 0)
  55. ;~ $iRows2 = UBound($aNewArray, 1)
  56. ;~ MsgBox(0,'',$iRows2)
  57. ;~ _ArrayDelete($aNewArray, $iRows2-1)
  58. ;~ MsgBox(0,'',$iRows2)
  59.  
  60. For $i = 1 To UBound($aNewArray) - 1
  61.     If $aNewArray[$i] = "" Then
  62.         ReDim $aNewArray[$i]
  63.         ExitLoop
  64.     EndIf
  65. Next
  66.  
  67.  
  68.  
  69. _ArrayDisplay($aNewArray, "$aNewArray возвращает первую размерность массива $aArray")
  70.  
  71.  
  72. EndIf
  73.  
  74.  
  75. #Region ### START Koda GUI section ### Form=
  76. $Form1 = GUICreate("Form1", 615, 438, 192, 124)
  77. $Combo1 = GUICtrlCreateCombo("Combo1", 96, 32, 337, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
  78. GUICtrlSetData(-1, "www|eee|rrr|ttt")
  79. $Input1 = GUICtrlCreateInput("Input1", 96, 64, 337, 21)
  80. $Edit1 = GUICtrlCreateEdit("", 96, 88, 345, 49)
  81. GUICtrlSetData(-1, "Edit1")
  82. $Edit2 = GUICtrlCreateEdit("", 96, 144, 345, 233)
  83. GUICtrlSetData(-1, "Edit2")
  84. GUISetState(@SW_SHOW)
  85. #EndRegion ### END Koda GUI section ###
  86.  
  87.  
  88.  
  89.  
  90. While 1
  91.     $nMsg = GUIGetMsg()
  92.     Switch $nMsg
  93.         Case $GUI_EVENT_CLOSE
  94.             Exit
  95.  
  96.     EndSwitch
  97. WEnd
  98.  
  99.  
  100.  
  101. ;~ $sResult = _AD_GetObjectAttribute($sOU, "Description")
  102. ;~ $sMail = _AD_GetObjectAttribute($sUser, "mail")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement