What is SciTe?
SciTE is a SCIntilla based Text Editor. Lua is embedded with SciTe which allows you to access the Scintilla API.
# lua code example
`command.go.*.js=jrunscript $(FileNameExt)`
How to run js code in SciTe?
Create a file called testConsole.js
with the following content.
var console = console || {};
console.log = ( console.log || function( str ){
if( typeof print == "function" ){
print( "LOG: " + str + "\n" );
}
return "LOG: " + str;
});
console.log( "Javascript works." );
Open testConsole.js
in SciTe.
To run the code, press F5
or click Tools
> Go
.
An output window should appear showing
LOG: Javascript works.
How do I configure SciTe to run javascript?
I'm using SciTe 3.2.0. Located here
In wscite\wsite320\cpp.properties
at line: 424
change:
command.go.*.js=cscript /nologo $(FileNameExt)
to:
command.go.*.js=jrunscript $(FileNameExt)
if you want to use node.js, then change it to
command.go.*.js=node $(FileNameExt)
Make sure that you have the jrunscript or node in your path for the environment variables.
Tutorial here
Do I have jrunscript
?
Here's the easiest way to check.
Open up run > type in cmd
> type jrunscript
.
js>
should appear on the screen.
jrunscript.exe
should be located here.
C:\Program Files\Java\jdk1.7.0_01\bin\jrunscript.exe
Download the lastest Java SDK if you can't find it.
Error Messages
What does 'Microsoft JScript runtime error: 'console' is undefined'
This means Microsoft JScript ran your javascript and couldn't find the variable console.
Define console to get rid of the error message.
var console = console || {};
console.log = ( console.log || function( str ){
if( typeof print == "function" ){
print( "LOG: " + str + "\n" );
}
return "LOG: " + str;
});
Microsoft JScript might be located here:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\jsc.exe
Error: Input Error: There is no file extension in "location"
Solution: You need to configure the cpp.properties file for javascript.
Error: script file test is not found
Solution: Rename the file. Make sure that it doesn't have any spaces.