Someone on korg wrote a non-goto EnumKey loop a while back, that only uses a single EnumKey call, anyone care to give a try. The manual example uses gotos:

Code:

$Index = 0
:Loop1
$KeyName = ENUMKEY("HKEY_CURRENT_USER\Console\", $Index)
If @ERROR = 0
? "Name found: $KeyName"
$Index = $Index + 1
goto Loop1
Endif



I know of a structured way using two EnumKeys:

Code:

$i = 0
$KeyName = EnumKey("HKEY_CURRENT_USER\Software\",$i)
While $KeyName
?"Name found: $KeyName"
$i=$i+1
$KeyName = EnumKey("HKEY_CURRENT_USER\Software\",$i)
Loop



But someone wrote a structured way using a single EnumKey ? Anyone ?