rameshk Posted December 7, 2006 Share Posted December 7, 2006 Can anyone help me in reading all the subkeys under a registry key? i need to cycle through them and find the required subkey based on the data in it. Thanks in advance. Link to comment Share on other sites More sharing options...
KJohn Posted December 7, 2006 Share Posted December 7, 2006 Can anyone help me in reading all the subkeys under a registry key? i need to cycle through them and find the required subkey based on the data in it. Thanks in advance.RegEnumKey ( "keyname", instance ) keyname The registry key to read. instance The 1-based key instance to retrieve Return ValueSuccess: Returns the requested subkey name.. Failure: Returns "" and sets the @error flag: 1 if unable to open requested key -1 if unable to retrieve requested subkey (key instance out of range) Does that answer your question?Related: RegEnumValRead through the AutoIt Help file for more information... Link to comment Share on other sites More sharing options...
KJohn Posted December 7, 2006 Share Posted December 7, 2006 $i = 1 $key = RegEnumKey("keyname",$i);first subkey While $key <> "" Msgbox(0,"SubKey number "&$i, $key) ;displays the subkey value $i = $i + 1 $key = RegEnumKey("keyname",$i) ;getting next subkey Wend Link to comment Share on other sites More sharing options...
rameshk Posted December 7, 2006 Author Share Posted December 7, 2006 It answers partially... but, how to get the ubound value for instance parameter (when the number of subkeys are not known in advance?RegEnumKey ( "keyname", instance ) keyname The registry key to read. instance The 1-based key instance to retrieve Return ValueSuccess: Returns the requested subkey name.. Failure: Returns "" and sets the @error flag: 1 if unable to open requested key -1 if unable to retrieve requested subkey (key instance out of range) Does that answer your question?Related: RegEnumValRead through the AutoIt Help file for more information... Link to comment Share on other sites More sharing options...
KJohn Posted December 7, 2006 Share Posted December 7, 2006 It answers partially... but, how to get the ubound value for instance parameter (when the number of subkeys are not known in advance? $ubound = 1 While RegEnumKey("keyname",$ubound) <> "" $ubound = $ubound + 1 Wend $ubound = $ubound - 1;as it will fail in the last check This is unnecessary code, I don't know of any other way to get the Ubound. Your code has to be adaptive as in the code snippet given previously. Link to comment Share on other sites More sharing options...
rameshk Posted December 7, 2006 Author Share Posted December 7, 2006 Thanks for all. The below code works fine for me... $i = 1 $key = RegEnumKey("KeyName",$i);first subkey While $key <> "" Msgbox(0,"SubKey number "&$i, $key) ;displays the subkey value $i = $i + 1 $key = RegEnumKey("KeyName",$i) ;getting next subkey If @error = -1 Then MsgBox(0, "Error", "Out of Range") ExitLoop EndIf Wend 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