I am reading the values for the "HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\Excel\microsoft excel" registry sub-key into an array, then sorting the array in ascending order. I want to read the string value of all the OPEN values. I set $valueIndex = 1 and then do:

Code:

For Each $element in $valuearray
If $element = "OPEN" + $ValueIndex
If @ERROR = 0
$stringvalue = ReadValue($regsubkey, $element)
? $stringvalue
$ValueIndex = $ValueIndex + 1
EndIf
EndIf
Next




My first problem is that after I get to OPEN9 it increments to OPEN10 but doesn’t read from value OPEN10 on. OPEN values are listed in ascending order as listed below:

OPEN
OPEN1
OPEN10
OPEN11
OPEN12
OPEN2
OPEN3
OPEN4
OPEN5
OPEN6
OPEN7
OPEN8
OPEN9

Which may be the reason it skips from OPEN10 on. Also I want to read the value of OPEN and if I set $valuearray = 0 or “”, the script doesn’t work.

Once I get past this point, my intensions are to verify string values are valid, remove duplicates or invalid entries and rename the next OPEN value if I have to delete a value. Hope I’m making sense and someone can help.