Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
belltown
Level 7

Notepad++ for BrightScript development on Windows

Someone (Komag) was asking about setting up Notepad++ as an ' IDE' for Roku development, so here are a few things I've done to make that work. It may seem like a lot of steps, but once you have it set up it makes it very easy to edit and deploy Roku code, if you're running a Windows system:

1. Download 7-ZIp from http://www.7-zip.org/download.html, a free zip program that you'll use for compressing the channel files. I downloaded the 64-bit x64 .msi installer from http://www.7-zip.org/a/7z920-x64.msi (that's the 9.20 version; there's a new version at least 15.12 , that I haven't tested yet).

2. Download curl from http://curl.haxx.se/download.html, a free program that you'll use to deploy files to your Roku. Go to: http://curl.haxx.se/download.html. Scroll down in the Packages section to the 'Win32 - Generic' entry and click on the Win32 zip version that just says "binary" (NOT one of the SSL versions). That will take you to another page that says, "cURL groks URLs". On that page click the 'Download WITHOUT SSL' link. Download and unzip. There should be a single file, curl.exe, that you should put in some directory reachable via your PATH environment variable, or specify the fully-qualified path-name in the macro defined in step 9 below. From a Windows command prompt, type: curl --version to check that you have the right version installed.

3. Download Notepad++ from http://notepad-plus-plus.org/download/
Note: you may want to initially set up and configure Notepad++ (particularly when changing the theme), while running as a Windows 'Administrator' (right-click on the Notepad++ executable, then click 'Run as administrator'), otherwise changes you make to the configuration may not be preserved. [See Komag's post later].

4. Set up your WIndows files associations, so that when you click on a .brs fie, it opens that file in Notepad++. To do this run Explorer, right-click on any .brs file, select Open with..., browse to the Notepad++ executable (C:\Program Files (x86)\Notepad++\notepad++.exe), check the box marked 'Always use the selected program to open this kind of file), click 'OK'.

5. Set up Notepad++ for syntax-highlighting of brs files using the VB/VBS template: Settings>Style Configurator... First, select the theme from the drop-down box. There are about 21 different colored themes to choose from. I just use the default, but if you like the fancy colors then go ahead, although I wouldn't recommend the bright pink Hello Kitty theme or you'll probably go blind! Next, from the Language drop-down, select 'VB / VBS', and in the User Ext. box type: brs
In the Style column, you can change the styles used for comments, keywords, operators, etc. The only one I change is to select "WORD" then enter any keywords in the User-defined keywords box that aren't treated like keywords in the VB / VBS language, e.g: endif void invalid float dynamic

6. Next, download any plugins you think you might need from Plugins>Plugin Manager>Show plugin manager. The ones I currently have installed are: Explorer, JSLint, MIME Tools, Converter, NppExec, JsonViewer, Hex-Editor, and XML Tools.

If all you are interested in is editing your BS files, then this is as far as you go. However, if you're interested in zipping and deploying your channel go ahead and set up macros to zip and deploy your channels to your Roku(s):

7. Ensure you have telnet enabled. It's not enabled by default on Windows 7, so you'll have to go to Start>Control Panel>Programs and Features>Turn Windows features on or off>Check 'Telnet Client'>OK. IMPORTANT: to be able to run telnet from Notepad++ if you're using a 64-bit Windows operating system, you'll have to copy C:\Windows\System32\telnet.exe to C:\Windows\SysWOW64\telnet.exe [Because the NppExec plugin will attempt to run the 32-bit version (from SysWOW64), which does not exist in a 64-bit system].

8. You'll be using the NppExec plugin for this. Set some general options: Plugins>NppExec>(check Follow $(CURRENT_DIRECTORY) and Console Commands History).

9. Set up the Deploy macro: Plugins>NppExec>Execute... then copy the following text into the Commands window:


// Save the current file
NPP_SAVE

// Only compress if we are editing a .brs file
if $(EXT_PART) = .brs goto compress
echo ****** Unable to compress unless within .brs file ******
goto end

:compress

// Set variable for directory containing .zip file (parent directory of the source directory)
set local devdir = ..

// Create a dev.zip file (Exclude dev.zip, README.md, and any .git* files)
C:\Program Files\7-Zip\7z u -x!dev.zip -x!README.md -xr!.git* $(devdir)/dev.zip $(devdir)/*
if $(EXITCODE) = 0 goto deploy
echo ****** Failed to create .zip file ******
goto end

:deploy

// Deploy the .zip file to the Roku(s)
//curl -u rokudev:4242 --digest -F "archive=@$(devdir)/dev.zip" -F "mysubmit=Replace" http://192.168.0.4/plugin_install
curl -u rokudev:4242 --digest -F "archive=@$(devdir)/dev.zip" -F "mysubmit=Replace" http://192.168.0.8/plugin_install

:end
echo Finished

Change "pswd" to your own password of course and make sure to use the correct IP address for each of your Rokus, commenting out any that you do need right now.
Also, the curl MSI installer I used set up the PATH environment variable to the curl directory, so I don't specify curl's full path name. You may need the full path depending on how you installed curl and where it is.
Click Save..., enter a Script name, e.g. RokuDeploy, click OK

10. To create a menu item for the macro: Plugins>NppExec>Advanced Options...>check Place to the Macros submenu
In the Menu item>item name field, enter RokuDeploy, then from the Associated script dropdown box, select RokuDeploy, click Add/Modify, then OK.

11. To set up a macro to run a telnet session against the Roku debugger, repeat steps 9 and 10, using a different macro name, e.g. RokuDebug, and the following script:


NPP_RUN cmd /k telnet 192.168.0.7 8085
NPP_CONSOLE 0

12.To set up shortcut keys to these macros: Macro>Modify Shortcut/Delete Macro...>Plugin commands>select RokuDeploy in the Name Column>click Modify then use whatever you want for a shortcut (I use CRTL/D for RokuDeploy and CTRL/B for RokuDebug). You have to be careful than the shortcut isn't already used for something else; if so you'll have to delete the other shortcut. In my case I had to go to Macro>Modify Shortcut/Delete Macro>Main menu and delete a shortcut already associated with CTRL/B.
https://github.com/belltown/
0 Kudos
6 Replies
Komag
Level 9

Re: Notepad++ for BrightScript development on Windows

This is awesome, thank you!
0 Kudos

Re: Notepad++ for BrightScript development on Windows

Thanks Belltown!

I normally use Sublime Text with nbrew's Textmate bundle (https://github.com/cmink/BrightScript.tmbundle) for syntax highlighting, along with an array of support scripts.

However, I am really interested to give your Notepad++ customizations a whirl.
0 Kudos

Re: Notepad++ for BrightScript development on Windows

In case you want to switch the default commenting from REM to ' when using CTRL-k/SHIFT-CTRL-k this post is helpful.

http://stackoverflow.com/questions/8147 ... in-notepad
0 Kudos
belltown
Level 7

Re: Notepad++ for BrightScript development on Windows

"mhardwick-vertigo" wrote:
In case you want to switch the default commenting from REM to ' when using CTRL-k/SHIFT-CTRL-k this post is helpful.

http://stackoverflow.com/questions/8147 ... in-notepad

Nice to know, although personally I like to use REM for commenting/un-commenting whole sections of code with CTRL-Q when I'm trying to comment out whole chunks of code during debugging, leaving the apostrophe comments for 'real' code comments. I can easily strip out all of my commented-out test code later by just looking for REM statements.
https://github.com/belltown/
0 Kudos
Komag
Level 9

Re: Notepad++ for BrightScript development on Windows

I do the same thing, and I'm glad we happen to have two different comment types for that
0 Kudos
Komag
Level 9

Re: Notepad++ for BrightScript development on Windows

I was having trouble with my style theme settings not being saved, but this helped:

http://stackoverflow.com/questions/1065 ... heme-in-np
Mainly this line:
"What I figured out: run notepad++ as administrator and it will keep the changes. After that you can run as regular user (the changes made will be reloaded)."

That's what finally worked for me.
0 Kudos