hemichallenger Posted June 14, 2014 Share Posted June 14, 2014 This is a example from AD. How can you display this in a Edit and not a _ArrayDisplay? ; Example 2; Display only selected properties for the current user; *****************************************************************************$aProperties = _AD_GetObjectProperties(@UserName, "displayname,distinguishedName")_ArrayDisplay($aProperties, "Active Directory Functions - Example 2 - Properties for user '" & @UserName & "'") Link to comment Share on other sites More sharing options...
guinness Posted June 14, 2014 Share Posted June 14, 2014 (edited) Use _ArrayToString() on $aProperties and then write to an edit control. Edited June 14, 2014 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
hemichallenger Posted June 16, 2014 Author Share Posted June 16, 2014 This isn't working what am i missing? $aProperties = _AD_GetObjectProperties(StringSplit($strAccount, '', $STR_ENTIRESPLIT)[2], "displayname,telephoneNumber,description") GUICtrlSetData($Output, _ArrayToString($aProperties, @CRLF ,0,2)) This way work with no issues. $aProperties = _AD_GetObjectProperties(StringSplit($strAccount, '', $STR_ENTIRESPLIT)[2], "displayname,telephoneNumber,description") _ArrayDisplay($aProperties,$strComputer) Link to comment Share on other sites More sharing options...
guinness Posted June 16, 2014 Share Posted June 16, 2014 Please post using the blue A symbol in the editor. What happens if you just use ... _ArrayToString($aProperties, @CRLF) UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
hemichallenger Posted June 16, 2014 Author Share Posted June 16, 2014 $aProperties = _AD_GetObjectProperties(StringSplit($strAccount, '\', $STR_ENTIRESPLIT)[2], "displayname,telephoneNumber,description") GUICtrlSetData($Output, _ArrayToString($aProperties, @CRLF)) Nothing happens the edit box stays blank. GUICtrlSetData($Output, "Username : "& StringSplit($strAccount, '\', $STR_ENTIRESPLIT)[2]) I put this in and the edit box displays this just fine to check if it was working. Link to comment Share on other sites More sharing options...
UEZ Posted June 16, 2014 Share Posted June 16, 2014 (edited) Here a modified version of _ArrayDisplayConsole.au3:expandcollapse popup#include <EditConstants.au3> #include <WindowsConstants.au3> Global $aArray[10][10] For $i = 0 To 9 For $j = 0 To 9 $aArray[$i][$j] = $i & "-" & $j Next Next Global $hGUI = GUICreate("Test", 600, 400) Global $iEdit = GUICtrlCreateEdit("", 0, 0, 600, 400, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $WS_HSCROLL)) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") GUICtrlSendMsg($iEdit, $EM_LIMITTEXT, -1, 0) GUISetState() _ArrayDisplayToControl($aArray, $iEdit, 5) Do Until GUIGetMsg() = -3 ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ArrayDisplayToControl ; Description ...: Displays given 1D or 2D array in the console only ; Syntax ........: _ArrayDisplayToControl($avArray, $iCtrl[, $iColumnWidth = 12[, $iItemLimit = -1[, $bDisplayCRNo = True]]]) ; Parameters ....: $avArray - Array to display ; $iCtrl - Control id of the control where the array content should be written to ; $iColumnWidth - [optional] String length of each cell ; $iItemLimit - [optional] Maximum number of lines (rows) to show ; $bDisplayCRNo - [optional] Display column / row numbers ; $bDisplayCellBorders - [optional] Display border of array cell to see any white space ; $sBorderChar - [optional] border character ; Return values .: Success - 1 ; Failure - 0, sets @error: ; | 1 - $avArray is not an array ; | 2 - $avArray has too many dimensions (only up to 2D supported) ; Author ........: UEZ ; Version .......: 0.90 build 2014-06-17 beta ; Modified ......: ; Remarks .......: None ; Related .......: UBound, IsArray, StringFormat, StringLeft, StringLen, GUICtrlSetData ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _ArrayDisplayToControl($avArray, $iCtrl, $iColumnWidth = 48, $iItemLimit = -1, $bDisplayCRNo = True, $bDisplayCellBorders = False, $sBorderChar = "*") If Not IsArray($avArray) Then Return SetError(1, 0, 0) Local $iDimension = UBound($avArray, 0), $iUBound = UBound($avArray, 1) - 1, $iSubMax = UBound($avArray, 2) - 1 If $iDimension > 2 Then Return SetError(2, 0, 0) If $iColumnWidth < 1 Then $iColumnWidth = 1 Local $iH, $iW, $iLenUBound = StringLen($iUBound), $sText If $bDisplayCRNo And $iSubMax > -1 Then $sText &= StringFormat("%-" & $iLenUBound + 1 & "s", " ") For $iW = 0 To $iSubMax $sText &= StringFormat("%-" & $iColumnWidth + 1 & "s", StringLeft($iW, $iColumnWidth)) Next $sText &= @CRLF EndIf If $iItemLimit > 0 Then $iUBound = $iItemLimit - 1 Switch $iDimension Case 1 For $iH = 0 To $iUBound If $bDisplayCRNo Then $sText &= StringFormat("%-" & $iLenUBound + 1 & "s", StringLeft($iH, $iColumnWidth)) If $bDisplayCellBorders Then $sText &= StringFormat("%-" & $iColumnWidth + 1 & "s", $sBorderChar & StringLeft($avArray[$iH], $iColumnWidth) & $sBorderChar) Else $sText &= StringFormat("%-" & $iColumnWidth + 1 & "s", StringLeft($avArray[$iH], $iColumnWidth)) EndIf $sText &= @CRLF Next Case 2 For $iH = 0 To $iUBound If $bDisplayCRNo Then $sText &= StringFormat("%-" & $iLenUBound + 1 & "s", StringLeft($iH, $iColumnWidth)) For $iW = 0 To $iSubMax If $bDisplayCellBorders Then $sText &= StringFormat("%-" & $iColumnWidth + 1 & "s", $sBorderChar & StringLeft($avArray[$iH][$iW], $iColumnWidth) & $sBorderChar) Else $sText &= StringFormat("%-" & $iColumnWidth + 1 & "s", StringLeft($avArray[$iH][$iW], $iColumnWidth)) EndIf Next $sText &= @CRLF Next EndSwitch $sText &= @CRLF GUICtrlSetData($iCtrl, $sText, 1) Return 1 EndFuncBr,UEZ Edited June 17, 2014 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
hemichallenger Posted June 16, 2014 Author Share Posted June 16, 2014 GUICtrlSetData($Output, "Telephonenumber : "& $aProperties[1][1]) I figured it out. Thanks. . Link to comment Share on other sites More sharing options...
hemichallenger Posted June 17, 2014 Author Share Posted June 17, 2014 Func _ADAccount() If $strAccount = Null Then MsgBox(16, "NULL", "No user currently logged on." ) Else _AD_Open() $aProperties = _AD_GetObjectProperties(StringSplit($strAccount, '\', $STR_ENTIRESPLIT)[2], "telephoneNumber") GUICtrlSetData($Output, "Username : "& StringSplit($strAccount, '\', $STR_ENTIRESPLIT)[2] & @CRLF & _ "Telephonenumber : "& $aProperties[1][1]) _AD_Close() EndIf EndFunc This works fine if the account exist in AD. But if the account doesnt exist I get a error and crash. or errors from a few accounts that end with .tmp that causes it to crash. how can i exempt these type of account so i get a message reply they dont exist in AD? Link to comment Share on other sites More sharing options...
hemichallenger Posted June 18, 2014 Author Share Posted June 18, 2014 Func _ADAccount() If $strAccount = Null Then MsgBox(16, "NULL", "No user currently logged on." ) ElseIf @error = 1 Then MsgBox(64, "Active Directory", "does not exist") Else _AD_Open() $aProperties = _AD_GetObjectProperties(StringSplit($strAccount, '\', $STR_ENTIRESPLIT)[2], "telephoneNumber") GUICtrlSetData($Output, "Username : "& StringSplit($strAccount, '\', $STR_ENTIRESPLIT)[2] & @CRLF & _ "Telephonenumber : "& $aProperties[1][1]) _AD_Close() EndIf EndFunc Think this is correct if the account doesn't exist. Filtering out account that end with .tmp I don't know how to. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now