Editing and testing scripts in SciTE

SciTE (the Scintilla Text Editor) is my text editor of choice. It’s fast, simple and lightweight. Not only that but it’s based on the Scintilla editor component which can be used in your own apps. There are a couple of versions available for download, my preferred one is Bruce Dodson’s version which amongst other things includes a Windows Explorer shell extension that adds an “Edit with SciTE” command for all file types.

There are plenty of other text editors available that are based upon the Scintilla core, such as Notepad2 and Notepad++, but they seem to lack the main feature that keeps me using SciTE. That is the ability to hit F5 when editing a script and have the console output appear in a separate pane in the editor window. I do plenty of batch file, VBScript, JavaScript scripting and with SciTE I can hit F5 to do a quick test. If any error occurs then the output window will jump to the offending line with a double-click if the error message follows the pattern:

<filename>(<line>, <col>) <error message>

…which is a fairly standard output format for most compilers and script interpreters.

The output window also supports standard input – which means if you have prompts in your scripts for input you can type them right into the output window.

SciTE can be extensively customised, as long as you don’t mind editing (albeit quite straightforward) configuration files. You can edit the core *.properties files in %ProgramFiles%Scintilla Text Editor, but you’d be better off opening your user options file which is stored at %USERPROFILE%SciTEUser.properties. I say this because there’s a better chance you’ll back up this file along with your user profile when you next pave your machine. There’s a shortcut to open or create a new the SciTEUser.properties file on the Options menu: Open User Options File.

Anyway, here’s what’s in my options file to help me develop Windows Scripting Host (*.vbs, *.js) scripts as well as good old batch files (*.cmd, *.bat) in SciTE. The key is to set the subsystem property to 0 so that all console input and output (stdin, stdout, stderr) end up in SciTE’s output window:

# *.vbs files
command.go.$(file.patterns.wscript)=cscript.exe //nologo "$(FilePath)"

# *.js files
command.go.*.js=cscript.exe //nologo "$(FilePath)"

# Run batch files inside SciTE

Hope that’s useful for someone else.

4 thoughts on “Editing and testing scripts in SciTE

  1. Exactly what I needed.. thanks .. I couldn’t figure out how to get the output from my .vbs script into the output window instead of a GUI popup window.. this did the trick..

  2. @rrf
    Maybe a little to late, but maybe someone reads this:
    You have to type
    cscript //H:CScript
    in a command prompt (or run as dialog) to change the default script interpreter from wscript to cscript

    1. Jim, you shouldn’t need to do that if you put the following in your SciTEUser.properties (Options menu > Open User Options file) file:

      command.go.*.js=cscript.exe //nologo “$(FilePath)”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s