Jochem Posted December 9, 2010 Share Posted December 9, 2010 (edited) I tried to make some script to collect software versiosn installed on the networkcomputers. I used this script (found on this forum, and changed it a little bit): Func _SoftwareInfo32($cI_CompName) $cI_CompName = "\\" & $cI_CompName & "\" Local Const $regkey = $cI_CompName & 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' Local $key, $regel = 0, $avArray[1] While 1 $regel = $regel + 1 $key = RegEnumKey($regkey, $regel) If @error Then ExitLoop $line1cel1 = RegRead($regkey & '\' & $key, 'Displayname') $line1cel2 = RegRead($regkey & '\' & $key, 'Displayversion') If @error Then ContinueLoop $avArray[0] += 1 ReDim $avArray[$avArray[0] + 1] $avArray[$avArray[0]] = $line1cel1 WEnd Return $avArray EndFunc this is working good, but the problem is that i want a second collumn to ad the version number. I tried manny things but nothing worked till now. Especially this part is what i dont`understand $avArray[0] += 1 ReDim $avArray[$avArray[0] + 1] $avArray[$avArray[0]] = $line1cel1 I thought more about this: ReDim $avArray[$regel] _arrayadd ($avArray [$regel][0], $line1cel1) _arrayadd ($avArray [$regel][1], $line1cel2) can somebody give me a tip. Edited December 9, 2010 by Jochem Link to comment Share on other sites More sharing options...
Mat Posted December 9, 2010 Share Posted December 9, 2010 $avArray[0] += 1 ReDim $avArray[$avArray[0] + 1] $avArray[$avArray[0]] = $line1cel1 Ok, this is fairly common code... Still not nice though. As a general practice thing (despite being frowned upon by many), the number of elements in an array is held in it's first element (zero). This is mostly because it's easier to work with than UBound, and also some internal functions such as StringSplit return it like that. So the first line is incrementing OUR counter of the array elements. The second is changing the AUTOIT size of the array using ReDim (see helpfile). The +1 is for the element with the counter itself. $avArray[$avArray[0]] now points to the last item in the array (the item at the value of the counter). We set it to the value You want 2 columns? Well you need a 2D array. This is my template code for this sort of stuff ; avArray: ; [0][0] = counter ; [*][0] = first column ; [*][1] = second column Local $avArray[1][2] ; An 'empty' 2d array Local $avArray[0][0] = 0 ; The counter ; Add an item: $avArray[0][0] += 1 ReDim $avArray[$avArray[0][0] + 1][2] ; We are only adding a row!! $avArray[$avArray[0][0]][0] = '1st' $avArray[$avArray[0][0]][1] = '2nd' It's very similar to the first code. A bit more complex though as the counter is now in [0][0]. It also helps when using multi dimensional arrays to say at the top what is stored where (see my comment at the top). Just makes it easy for reference later. Is that answering the question? AutoIt Project Listing Link to comment Share on other sites More sharing options...
Jochem Posted December 9, 2010 Author Share Posted December 9, 2010 thanks, great explanation! I will continue working on the script tomorrow. Link to comment Share on other sites More sharing options...
DXRW4E Posted September 16, 2012 Share Posted September 16, 2012 Ciao. Link to comment Share on other sites More sharing options...
guinness Posted September 16, 2012 Share Posted September 16, 2012 (edited) DXRW4E, Try to refrain from opening dead threads, especially when the question has already been provided. Edited September 16, 2012 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...
DXRW4E Posted September 16, 2012 Share Posted September 16, 2012 (edited) not open or anything, only indicated a solution that in my opinion and better if you do not like hmmmmmmmm instead of saying thanks (for the release of _RegEnumKeyEx) you say hmmmmm (however it seems that your problem is not mine) I do not know what to say, from the way you wrote it seems that you gave to nuisance one of my publications hmmmmmmm okay anyway Edited September 16, 2012 by DXRW4E Link to comment Share on other sites More sharing options...
guinness Posted September 16, 2012 Share Posted September 16, 2012 I think you've misunderstood my point entirely as well as the tone of my last post. Firstly you're providing a solution to a user who hasn't even logged into their account in 5 months, so what's the likelihood they will now or will even need this solution. Secondly, most of us have seen your example in the Examples section, so there is no need to post duplicate copies all over the forum. This doesn't mean I'm not appreciative of your work. 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...
DXRW4E Posted September 16, 2012 Share Posted September 16, 2012 (edited) I understand, I apologize (I'm really sorry) the point is that I before making the RegEnumKeyEx, or read in forums and looking for RegEnumKey, have left 20-30 topics ect ect, after or fate to me that RegEnumKeyEx, after I had already in Firefox browser these posts and precisely or posted here and in another post always with idea to be of help, because I'm confused actually looking RegEnumKey + array ect ect, there are many topics with all the hanging question and all without a real solution sorry again Ciao. Edited September 16, 2012 by DXRW4E Link to comment Share on other sites More sharing options...
BrewManNH Posted September 16, 2012 Share Posted September 16, 2012 guiness' point was that you posted to a 2 year old thread about something the original poster will never see or care about since he hasn't been here in 5 months. Necro posting dead threads is pointless, and a waste of time. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
DXRW4E Posted September 16, 2012 Share Posted September 16, 2012 (edited) I know I know, the point was that, before I do RegEnumKeyEx (google sent me to this old topic) I ended up in this topic and many other old topic (looking for a solution), and it more confusing to me ect ect, or put the link up there, not to create even more confusion but with the intention to do better, if someone else like me end up in some old posts also find new posts ect ect sorry again for my english Ciao Edited September 16, 2012 by DXRW4E 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