Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Organizing an array

$
0
0
I would like to produce an array where one column holds the username and the other column holds the client name for that user. So far, I have all of the data (as well as what I call "junk data", which in this case is the SID of the user) and the two columns. I just don't know how to split the data into the columns. Any help is appreciated.
Here is the code

[ autoit ]         
#include <Array.au3> #include <File.au3> Local $aArray For $i=1 to 50 Global $sID= RegEnumKey("HKEY_USERS\",$i) $len= StringLen($sID) If $len < 9 Then $file="c:\temp\junk.txt" FileOpen($file,1) FileWrite($file,$sID & @CRLF) FileClose($file) FileDelete($file) Else If $len < 51 Then $sUser=RegRead("HKEY_USERS\"&$sID&"\"&"Volatile Environment","USERNAME") $sVenv=RegEnumKey("HKEY_USERS\"&$sID&"\"&"Volatile Environment\",1) ;~ Msgbox(1,"",$sUser) ;~ MsgBox(1,"",$sVenv) $cClient=RegRead("HKEY_USERS\"&$sID&"\"&"Volatile Environment\"&$sVenv,"CLIENTNAME") ;~ MsgBox(1,"",$cClient) $file="c:\temp\sid.txt" FileOpen($file,1) FileWrite($file,$sID & @CRLF) FileWrite($file,"Username: "&$sUser & @CRLF) FileWrite($file,"Computer Name: " &$cClient & @CRLF) FileClose($file) Endif Endif Next $file="c:\temp\sid.txt" Local $aArray _FileReadToArray($file,$aArray) _FileWriteFromArray($file,$aArray) _ArrayDisplay($aArray) _1Dto2DArray($aArray, 1) _ArrayDisplay($aArray) Func _1Dto2DArray(ByRef $aArray, Const $iAdditionalColumns = 1)     Local Const $iSize = UBound($aArray, 1)     Local $aReturn[$iSize][$iAdditionalColumns + 1]     For $A = 0 To $iSize - 1         $aReturn[$A][0] = $aArray[$A]     Next     $aArray = $aReturn     Return $aReturn EndFunc   ;==>_1Dto2DArray FileDelete($file)

Viewing all articles
Browse latest Browse all 12506

Trending Articles