"SkipFire" wrote:
when I try to write the roArray to the registry it complains of a type mismatch. I would like to hear how others have done this. I would prefer to keep the search term on the Roku rather than sending it to the server.
'code excerpt from a search screen
'm.tquerystring contains is the current search term.
'histlist contains list of search terms loaded from the registry
histlist=m.historylist 'this line should go at the very top of the search function
flag=0
for i=0 to histlist.count()-1
if m.tquerystring=histlist[i]
flag=1
end if
next i
if flag <> 1 then
histlist.unshift(m.tquerystring)
if histlist.count() > 9
histlist.pop()
end if
end if
searchscr.setsearchterms(histlist)
m.historylist=histlist
writereg("history","searchhist",arraytostring(histlist))
function AddHistory(id,histlist) as object
flag=0
for i=0 to histlist.count()-1
if id=histlist[i]
flag=1
end if
next i
if flag <> 1 then
histlist.unshift(id)
if histlist.count() > 10
histlist.pop()
end if
end if
m.mixhist=histlist
writereg("history","mixhist",arraytostring(histlist))
return m.mixhist
end function
function arraytostring(array as object) as string
str=""
for each element in array
if element <> invalid
str=element+","+str
end if
next
return left(str,len(str)-1)
end function
function loadsearchHistory()
if not checkreg("history","searchhist") then
?"no search history in the registry"
createregsection("history","searchhist", "")
else
?"found search history, loading"
histemp=box(readreg("history","searchhist").tokenize(","))
i=histemp.count()-1
j=0
while true
if i=-1 or j > histemp.count() -1
exit while
end if
m.historylist[j]=histemp[i]
i=i-1
j=j+1
end while
end if
end function
function createregsection(secname as string,keyname as string, keyvalue as string)
registry=createobject("roregistry")
section=createobject("roregistrysection",secname)
section.write(keyname,keyvalue)
end function
function checkreg(secname as string,keyname as string) as boolean
registry=createobject("roregistry")
section=createobject("roregistrysection",secname)
return section.exists(keyname)
end function
function readreg(secname as string, keyname as string) as string
registry=createobject("roregistry")
section=createobject("roregistrysection",secname)
return section.read(keyname)
end function
function writereg(secname as string, keyname as string, keyvalue as string) as boolean
registry=createobject("roregistry")
section=createobject("roregistrysection",secname)
section.write(keyname,keyvalue)
end function
function deletekey(secname as string,keyname as string) as boolean
registry=createobject("roregistry")
section=createobject("roregistrysection",secname)
return section.delete(keyname)
end function
function deleteSection(secname as string) as boolean
registry=createobject("roregistry")
return registry.delete(secname)
end function
function regflush()
registry=createobject("roregistry")
registry.flush()
end function
We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. Read more here.
Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 19th and you may notice reduced functionality.
In the meantime, for additional assistance, visit our Support Site.
We're sorry for this disruption — we’re excited to share what’s next!