Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
el_horace
Reel Rookie

How to use m in a .brs file executed by Run() function

Hi everyone,

I'm executing .brs files by using Run() function and it works fine.

The problem is when I need to use m in the .brs file executed by Run() function, in this file the m is not defined.

And the question is: How can I access to m from this file?

Thank you

0 Kudos
4 REPLIES 4
renojim
Community Streaming Expert

Re: How to use m in a .brs file executed by Run() function

I don't really think you can use it.  You can pass it as a parameter to Run (e.g., Run(runthis.brs, m)), but trying to modify any element will really screw things up. Your runthis.brs's main function should be defined as Function main(aa as Object) as Object   You can then access the main m as aa.whatever.  You should really pass in whatever you will use as parameters to Run and then return anything you'll need in your main code.  Update m in your main .brs from the returned value(s) if need be.

 

-JT

Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
el_horace
Reel Rookie

Re: How to use m in a .brs file executed by Run() function

Hi JT,

Thank you for your reply, yes I have tried to pass m as paramater but it is not posible, just sending as you said: Run(runthis.brs, m), the player crash and it is reloaded, in fact I tried to send into an array and is exactly the same, the player crashes.

Now what Im trying is run NodeJS like this:

    r = CreateObject("roRectangle", 0,0,1920,1080)
    random = Rnd(5000)
    Print "random = ";random

    is = {
        port: random
    }
    config = {
        nodejs_enabled: true
        inspector_server: is
        brightsign_js_objects_enabled: true
        url: "file:///sd:/nodejs/index.html"
    }
    m.h = CreateObject("roHtmlWidget", r, config)
    m.h.Show()

And when i execute this from my main .brs it works fine, but only if I execute this with the m, I mean if I execute it without m like this code NodeJS is not running:

    h = CreateObject("roHtmlWidget", r, config)
    h.Show()

And that is my issue, I need to load NodeJS from a .brs file(not from the main .brs) and in those files I have not m, do you have any idea how can I init NodeJS in a .brs file executed with Run() function?

Thank you

0 Kudos
renojim
Community Streaming Expert

Re: How to use m in a .brs file executed by Run() function

Ah, is this a BrightSign product?  You may do better posting here:

https://brightsign.zendesk.com/hc/en-us/community/topics/200594547-BrightSign-General-Community

(Thank @RokuKC for the link)

Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
el_horace
Reel Rookie

Re: How to use m in a .brs file executed by Run() function

Yes, is a BrightSign, thank you I'm gong to try over there.

But I tell you my advance, what I do is:

Im exeuting those .brs files via Run() sending UDP messages, and the only thing I response in that specific file is a flag to say to my main .brs that executes a function that loads NodeJS the trick is thah in this main file the m exists, and because of it: works

Thank you so much for your reply

0 Kudos