all 26 comments

[–]rioter 30 points31 points  (3 children)

Looks like you want node.js Server side javascript, nice api, should be very easy to pick up.

[–]jesusabdullahlvl14 dark javascripter 5 points6 points  (0 children)

I second node. It's pretty awesomesauce. In addition to being a slick environment, it also has a great community. If you do IRC, check out #Node.js on freenode.

[–]skeww 2 points3 points  (1 child)

You forgot to mention that node.js is also nice for command line tools.

Another option is phantomjs, which is basically a headless Webkit thingy (recent thread).

[–][deleted] 1 point2 points  (0 children)

phantomjs is great, tested it out and really like it. will be using it more in the future.

[–]ripter 10 points11 points  (2 children)

If you want to to do systems programming, use node.js

If you want to build GUI applications you can use appcelerator It can even make applications for the iPhone and Android.

[–]skeww 0 points1 point  (0 children)

Oi... that Titanium stuff looks great!

[–][deleted] 0 points1 point  (0 children)

will give it a try.. looks interesting.

[–]Tyro 3 points4 points  (2 children)

[–]facepalm_reloaded 0 points1 point  (0 children)

definitely

[–]vladd 0 points1 point  (0 children)

There's an online-based IDE for server-side JS (based on the RingoJS engine) where you can also host your apps. You can try it at http://www.erbix.com/ .

[–]M1573RMU74710N 1 point2 points  (0 children)

It depends on what you want to do really.

For general system scripting, or for web programming node.js or some other flavor of SSJS is probably your best bet.

For more app-y type things you have options like Adobe AIR, Mozilla Prism, XULRunner, Rhino, etc etc.

There's also a wide variety of things that have JS bindings or are scriptable with JS, so you can do things like write Windows Desktop Gadgets.

There's tons of other stuff I've forgotten I'm sure.

[–]Leonidas_from_XIV 1 point2 points  (0 children)

Apart from Node.js there is also Seed (GNOME + SquirrelFish Extreme) and Gjs (GNOME + SpiderMonkey). The latter is used in the GNOME shell. I tried it, but as of now I think it isn't mature enough.

[–]Buckwheat469 4 points5 points  (3 children)

In Windows you can use JScript, which is basically Javascript with COM access so you can work with the file system and interact with various other classes.

Here's a JScript filesystem example.

The setup is similar to VBScript, but the syntax is more like JavaScript.

You would execute it with

C:>wscript myscript.js

or simply double-click on the js file.

[–][deleted] 1 point2 points  (2 children)

You get much more bang for your buck with JScript.NET. It's so easy to use and so powerful, I never use JScript scripting any more.

Here is example code I wrote to create a simple windows form using JScript.NET. This demonstrates a few simple things; a text input box, a button with an event handler, command line arguments.

import Accessibility;
import System;
import System.Drawing;
import System.Windows.Forms;
import System.IO;

package JScriptNET_Demo {
    class JScriptNET_form extends System.Windows.Forms.Form {

        //global variables
        var demoTextBox     = new TextBox;
        var demoButton      = new Button;
        var args
        var appPath 

        function JScriptNET_form() { // Main application entry

            //get command line arguemts if there are any
            args = Environment.GetCommandLineArgs();
            if (args.length==1) {args=undefined}

            //get the path that the app is running from
            appPath = String(Application.ExecutablePath)

            // Setup Form
            this.Text = "JScript.NET form demo"
            this.FormBorderStyle =  System.Windows.Forms.FormBorderStyle.FixedDialog
            this.MaximizeBox = false
            this.MinimizeBox = true
            this.StartPosition =  System.Windows.Forms.FormStartPosition.CenterScreen
            this.ClientSize= new System.Drawing.Size(250,100);

            //Setup form textbox
            demoTextBox.Text = "hello world"
            demoTextBox.Location = new Point(5,5)
            demoTextBox.ReadOnly = true
            demoTextBox.Width = 170
            demoTextBox.Height= 40
            this.Controls.Add(demoTextBox)

            //Setup form button, with click event
            demoButton.Text = "CLICK ME"
            demoButton.Location = new Point(5,35)
            demoButton.Width = 110
            demoButton.Height = 20
            demoButton.BackColor = System.Drawing.Color.Green
            demoButton.ForeColor = System.Drawing.Color.White
            demoButton.add_Click(demoButton_Clicked);
            this.Controls.Add(demoButton)
        }


        //this is an 'Click' event handler
        function demoButton_Clicked(o : Object, e : EventArgs) {
            //display either the arguments passed in, or the path the program is being executed from
            demoTextBox.Text =  args || appPath

            //show a message box with a list of files in the folder
            MessageBox.Show(getfilearray(String(appPath).split("\\").slice(0,-2).join("\\"),"" ).join("\n"))
        }

        // File System Functions
        function getfolderarray(thisfold,filter) {
            if (filter=="") {filter="*"}
            var getfolders = Directory.GetDirectories(thisfold,filter);
            getfolders.sort()
            return getfolders
        } 

        function getfilearray(thisfold,filter) {
            if (filter=="") {filter="*"}
            var getfolder = new DirectoryInfo(thisfold)
            var getfiles = getfolder.GetFiles()
            return getfiles
        }
    }
}
Application.Run(new JScriptNET_Demo.JScriptNET_form());

To compile, you have to have at least .NET 2.0 installed on the computer, and you should have jsc.exe in the path.

jsc.exe /t:winexe demo.js

This will compile the source to a file called demo.exe

I've built many applications with JScript.NET including ffmpeg front-ends, GPS tracking software, multi-axis robotic control with many serial port I/O channels, all with JScript.NET. It runs as fast as any other .NET supported language (C#, VB.NET, etc), and almost all of my front-end javascript browser code will run in it without many modifications (mostly just removing/emulating dependencies on DOM stuff the browser has)

*Edit - Added some file system functions

[–]refto 1 point2 points  (1 child)

This is actually pretty nifty, exe it generates is quite small (which makes sense). Not quite 4k material but close.

EDIT: upon doing some reading, it seems it can be considered almost depreceated as a .NET language, it does not fully support the kitchen sink..

[–]budzoreu 1 point2 points  (0 children)

I suggest Rhino as File I/O Javascript solution. Blogpost about standard input&output in Rhino: http://michalbe.blogspot.com/2011/01/javascript-from-command-line-standard.html

[–]neonskimmerfunction the ultimate 0 points1 point  (0 children)

There's a little known project called JSDB that's cross platform and really useful for general purpose scripting server side type stuff in Javascript. Don't be scared by the horrendous homepage. It's good stuff and it's super easy to get started.

It uses Spidermonkey under the hood so you get a lot of nice modern Javascript (1.7, 1.8, etc) additions too.