Forum Discussion

haamro's avatar
haamro
Visitor
8 years ago

[SOLVED] Returning value from function with Task

Hello, I am trying to get a content from the web using Task. The Sub works great, except I am having difficulty returning the value from the function. Can somebody help me.

<?xml version="1.0" encoding="utf-8" ?>
 
<component name = "postergridCR" extends = "Task" >
 
  <interface>
    <field id = "postergriduri" type = "string" />
    <field id = "postergridcontent" type = "string"/>
  </interface>
 
  <script type = "text/brightscript" >
    <![CDATA[
 
    sub init()
      m.top.functionName = "getContent"
    end sub
 
    sub getContent()
      readInternet = createObject("roUrlTransfer")
      readInternet.setUrl(m.top.postergriduri)
      postergridcontent = readInternet.GetToString()
      m.top.postergridcontent = postergridcontent
   end sub
 
    ]]>
  </script>
 
</component>

I am trying to return the content from the above function
function getwebcontent(webpage as string)

   m.myObj = createObject("RoSGNode", "postergridCR")
   m.myObj.postergriduri=webpage
   m.myObj.functionName="getcontent"
   m.myObj.control = "RUN"
   return m.myObj.postergridcontent  <<======== How do I return the content ??

end function

Edit: Post marked as solved

16 Replies