BodoWitcha Posted May 17, 2008 Share Posted May 17, 2008 When I try to use the Functions RegEnumKey and RegEnumVal I get unexpected results:I have made this sample code:ConsoleWrite('RegEnumVal' & @LF) ; For $i = 1 To 3 $var = RegEnumVal("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\", $i) If @error <> 0 Then ConsoleWrite("@error: " & @error & @LF) ExitLoop EndIf ConsoleWrite("SubVal #" & $i & " under HKLM\CurrentControlSet\Control\Session Manager\Environment: " & $var & @LF) Next ; ConsoleWrite('RegEnumKey' & @LF) ; For $i = 1 To 3 $var = RegEnumKey("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\", $i) If @error <> 0 Then ConsoleWrite("@error: " & @error & @LF) ExitLoop EndIf ConsoleWrite("SubKey #" & $i & " under HKLM\CurrentControlSet\Control\Session Manager\Environment: " & $var & @LF) Nextand I get the following results:Watch the version (3.2.12.0)>Running:(3.2.12.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Program Files\ComicHtmlMenuBuilderDevelopment\remove before shipping\tst.au3" RegEnumVal SubVal #1 under HKLM\CurrentControlSet\Control\Session Manager\Environment: CLASSPATH SubVal #2 under HKLM\CurrentControlSet\Control\Session Manager\Environment: ComSpec SubVal #3 under HKLM\CurrentControlSet\Control\Session Manager\Environment: FP_NO_HOST_CHECK RegEnumKey @error: -1Please help me outAs far I can see from RegEnumVal I get keys and from RegEnumKey I get an error Link to comment Share on other sites More sharing options...
Developers Jos Posted May 17, 2008 Developers Share Posted May 17, 2008 I don't have any keys in that Registry tree, only fields and values. what is it you expected to see ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
BodoWitcha Posted May 17, 2008 Author Share Posted May 17, 2008 I don't have any keys in that Registry tree, only fields and values.what is it you expected to see ?I expected to see instead of CLASSPATH e.g. .;C:\Program Files\Java\jre1.6.0_03\lib\ext\QTJava.zip Link to comment Share on other sites More sharing options...
BodoWitcha Posted May 17, 2008 Author Share Posted May 17, 2008 I found the bug. It is my brain. I shuffeld too much with key field and values. Thanks for the quick reaction. Link to comment Share on other sites More sharing options...
Developers Jos Posted May 17, 2008 Developers Share Posted May 17, 2008 Like this? ConsoleWrite('RegEnumVal' & @LF) ; For $i = 1 To 3 $var = RegEnumVal("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\", $i) If @error <> 0 Then ConsoleWrite("@error: " & @error & @LF) ExitLoop EndIf $fieldval = RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment",$var) ConsoleWrite("SubVal #" & $i & " under HKLM\CurrentControlSet\Control\Session Manager\Environment: " & $var & " : " & $fieldval & @LF) Next SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
BodoWitcha Posted May 17, 2008 Author Share Posted May 17, 2008 Like this? ConsoleWrite('RegEnumVal' & @LF) ; For $i = 1 To 3 $var = RegEnumVal("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\", $i) If @error <> 0 Then ConsoleWrite("@error: " & @error & @LF) ExitLoop EndIf $fieldval = RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment",$var) ConsoleWrite("SubVal #" & $i & " under HKLM\CurrentControlSet\Control\Session Manager\Environment: " & $var & " : " & $fieldval & @LF) Next Absolutely right. Thanks. 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