Code:
Dim $SO,$Re ,$R, $S, $J
;Script Options
$SO=SETOPTION("Explicit", "ON")
$SO=SETOPTION("NoMacrosInStrings", "ON")
$SO=SETOPTION("NoVarsInStrings", "ON")
$SO=SETOPTION("WrapAtEOL", "ON")
BREAK ON
;Read the value at the given location
$R = ReadValue("HKCU\Software\Golfing","Round1")
;Split the value as a Reg_Multi will include the | character
$S = Split($R,"|")
;Now take each of the elements and put them back together
;with a space to check the value = what we want
$J = Join($S," ")
;Does it match?
If $J = "Enterprise Terminal Server ";space added at end as the join adds one
? "We have a match. The string returned was: " $J
Else
? "No match found. The string returned was: " $J
EndIf
;The value of $J was verified by printing out each of the elements of
;$S Array with the following code
/*
For $ = 0 to Ubound($S)
? $S[$]
Next
*/
;When attempting to do the join, with the optional "count", it did not work.
;I was unable to determine why the following would not work
/*
$J = Join($S," ",Ubound($s)-1)
*/
;To make this more robust one should verify that the value exist first
;then they should read the value type and write a routine to know how the
;expected return is going to be formatted, by no means should the following
;snippet be deemed fully functional, one would need to evaluate the returns
;of the different data types and build the appropriate "CASE" statement for
;that scenario
;Example
/*
If KeyExist("HKCU\Software\Golfing\Round1") = 1
$Type = Readtype("HKCU\Software\Golfing","Round1")
$R = ReadValue("HKCU\Software\Golfing","Round1")
Select
Case $Type = "Reg_Multi_SZ"
$S = Split($R,"|")
$J = Join($S," ")
Case $Type = "Reg_SZ"
$J = $S
Case 1
@Error = 5
EndSelect
Else
Exit 1
EndIf
*/