Posted September 16, 201212 yr Ragazzi cercando in Autoit forum per un codice da leggere il registro, e non trovando niente, ecco o fato questo codice che sembra davvero OKKK, per chi usa AutoIt la troverà davvero tanto tanto utile#RequireAdmin#include <Array.au3>$KeyName = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft";$KeyName = "HKEY_CLASSES_ROOT" ;104718;$KeyName = "HKEY_LOCAL_MACHINE\SOFTWARE\Classes"Global $a1, $b1$a1 = TimerInit()$b1 = _RegEnumKeyEx($KeyName, 0, "Opti*Components") ; to find HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\OptionalComponents$a1 = TimerDiff($a1)_ArrayDisplay($b1, $a1); #FUNCTION# ========================================================================================================================; Name...........: _RegEnumKeyEx; Description ...: Lists all subkeys in a specified registry key; Syntax.........: _RegEnumKeyEx($KeyName[, $iFlag = 0[, $sFilter = "*"]]); Parameters ....: $KeyName - The registry key to read.; $iFlag - Optional specifies Recursion; |$iFlag = 0 (Default) All Key-SubKeys Recursive Mod; |$iFlag = 1 All SubKeys Not Recursive Mod; $sFilter - Optional the filter to use, default is *. (Multiple filter groups such as "All "*.XXx|*.YYY|*.ZZZ"); Search the Autoit3 helpfile for the word "WildCards" For details.; Return values .: Success - Return Array List (See Remarks); Failure - @Error; |1 = Invalid $sFilter; |2 = No Key-SubKey(s) Found; Author ........: DXRW4E; Modified.......:; Remarks .......: The array returned is one-dimensional and is made up as follows:; $array[0] = Number of Key-SubKeys returned; $array[1] = 1st Key\SubKeys; $array[2] = 2nd Key\SubKeys; $array[3] = 3rd Key\SubKeys; $array[n] = nth Key\SubKeys; Related .......:; Link ..........:; Example .......: _RegEnumKeyEx("HKEY_CURRENT_USER\Software\AutoIt v3"); Note ..........:; ===================================================================================================================================Func _RegEnumKeyEx($KeyName, $iFlag = 0, $sFilter = "*")If StringRegExp($sFilter, "[\\/:><]|(?s)\A\s*\z") Then Return SetError(1, 0, "")Local $DX_REKI[101] = [100], $DX_REKISN, $BS = "\", $DX_REKNL, $I = 1, $DX_Filter = StringRegExpReplace($sFilter, "[\*\s]+", ""), $DX_REKFilter = "(?i)(" & StringRegExpReplace(StringRegExpReplace(StringRegExpReplace(StringRegExpReplace(StringRegExpReplace(StringRegExpReplace("|" & $sFilter & "|", '\|\h*\|[\|\h]*', "\|"), '[\^\$\(\)\+\[\]\{\}\,\.\]', "\\$0"), "\|([^\*])", "\|^$1"), "([^\*])\|", "$1\$\|"), '\*', ".*"), '^\||\|$', "") & ")"While $I$DX_REKI[$I] += 1$DX_REKISN = RegEnumKey($KeyName, $DX_REKI[$I])If @error Then$DX_REKI[$I] = 0$I -= 1$KeyName = StringLeft($KeyName, StringInStr($KeyName, "\", 1, -1) - 1)ContinueLoopEndIfIf $DX_Filter ThenIf StringRegExp($DX_REKISN, $DX_REKFilter) Then $DX_REKNL &= @LF & $KeyName & $BS & $DX_REKISNElse$DX_REKNL &= @LF & $KeyName & $BS & $DX_REKISNEndIfIf $iFlag Then ContinueLoop$I += 1If $I > $DX_REKI[0] Then$DX_REKI[0] += 100ReDim $DX_REKI[$DX_REKI[0] + 1]EndIf$KeyName &= $BS & $DX_REKISNWEndIf Not $DX_REKNL Then Return SetError(2, 0, "")Return StringSplit(StringTrimLeft($DX_REKNL, 1), @LF)EndFuncCiao a tutti. Edited September 16, 201212 yr by OnePiece
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.