Forum Discussion

greid's avatar
greid
Visitor
12 years ago

problems with roRegistrySection

I am having no lucking getting local storage to work for "roRegistrySection". It looks correct, and I've tried several variations, but the "read" never finds what was written. I don't get any errors, but I also don't get any stored codes. What am I missing?

Here's the current code:


Function GetStoredRegCode() As Dynamic
REM registry = CreateObject("roRegistry")
sec = CreateObject("roRegistrySection", "Authentication")
if sec.Exists("UserRegistrationToken")
print "Exists: UserRegistrationToken"
code = sec.Read("UserRegistrationToken")
print "Found Stored RegCode: " + code
return code
else
print "DOES NOT Exist: UserRegistrationToken"
endif
return invalid
End Function

Function SetStoredRegCode(regCode As String) As Void
print "Storing: UserRegistrationToken " + regCode
REM registry = CreateObject("roRegistry")
sec = CreateObject("roRegistrySection", "Authentication")
sec.Write("UserRegistrationToken ", regCode)
sec.Flush()
End Function
  • Your Write statement has an extra space at the end of the registry entry name. So you're writing to one name and reading from a different name.

    --Mark
  • Thank you, Mark! I copy/pasted the code directly from the Roku "Component Reference.pdf", page 99, which I now see has the SAME BUG (extra space). I'd recommend fixing the documentation 🙂 I've found a number of inconsistencies in the docs but I didn't see this one.

    Thanks again!!
  • Thanks, I've fixed the doc.
    If you do see any other errors or inconsistencies in the docs, please post them and we'll get them fixed.

    --Mark