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: 
karmacode
Visitor

Running Brightscript remote code

Hello,
I am trying to figure out a way to execute remote Brightscript code through Roku. Is this possible?
http://www.connectedtvforum.com
0 Kudos
5 REPLIES 5
YungBlood
Streaming Star

Re: Running Brightscript remote code

Yes, it's possible. If you are trying to run a single .brs file, just download it using roUrlTransfer, and then run() it. If you are trying to run a program with multiple files, you will have to develop a way to organise them, and figure out which ones to put in an array to run().

Games 4 Roku is built on that concept. And I can run programs with lots of files.
YungBlood

Bringing more fun to Roku!
0 Kudos
gonzotek
Visitor

Re: Running Brightscript remote code

"YungBlood" wrote:
Yes, it's possible. If you are trying to run a single .brs file, just download it using roUrlTransfer, and then run() it. If you are trying to run a program with multiple files, you will have to develop a way to organise them, and figure out which ones to put in an array to run().

Games 4 Roku is built on that concept. And I can run programs with lots of files.
+1. See Section 6.5 of the BrightScriptReferenceManual.pdf. Also the next section, Eval(), if you only need a short code snippet.
Remoku.tv - A free web app for Roku Remote Control!
Want to control your Roku from nearly any phone, computer or tablet? Get started at http://help.remoku.tv
by Apps4TV - Applications for television and beyond: http://www.apps4tv.com
0 Kudos
EnTerr
Roku Guru

Re: Running Brightscript remote code

"YungBlood" wrote:
If you are trying to run a program with multiple files, you will have to develop a way to organise them, and figure out which ones to put in an array to run().

Speaking of which, is there any additional meaning (eg. scope) to separating source in different files, or is it just one big #include. Does the interpreter care if files are separated or "copy *.brs blob.brs"?
0 Kudos
RokuJoel
Binge Watcher

Re: Running Brightscript remote code

Not really, it is just helpful for keeping track of what is where for sanity. Best not to go overboard with lots of small files as they frequently won't compress as well as a few medium sized .brs files. The interpreter does not care either way as far as I know, as long as you don't have the same function or sub name used twice within a project.

- Joel
0 Kudos
TheEndless
Channel Surfer

Re: Running Brightscript remote code

"gonzotek" wrote:
Also the next section, Eval(), if you only need a short code snippet.

Be aware that any script you Eval() should be less than 32k (I think it was increased to ~48k in 3.x). Anything larger, and you're likely to hard crash the box. I created a "Reboot" channel awhile back that took advantage of this little gem.. 😛

"RokuJoel" wrote:
Not really, it is just helpful for keeping track of what is where for sanity. Best not to go overboard with lots of small files as they frequently won't compress as well as a few medium sized .brs files. The interpreter does not care either way as far as I know, as long as you don't have the same function or sub name used twice within a project.

- Joel

Furthermore, you can have multiple subfolders as well under the source folder. All *.brs files under the source folder get combined into one giant BrightScript, regardless of location in the tree.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos