Script Windows

Script windows are typically distinguished by their file extension of .ijs. Note that this extension is not required - in fact any file that does not have an extension of .ijx is treated as a script window. However, it is good practice to use .ijs for any file intended as a J script.

When you create new script windows, the names used are 1.ijs, 2.ijs and so on. By default, 1.ijs is used, however if a file of this name already exists, the next available unused name is picked.

When you open an existing script, by default the script window is read only, indicated by the background color. Select menu Edit|Read Only or press Ctrl+T to toggle the read only state. You can configure this behaviour in Edit|Configure|Session.

When editing is enabled, you can type sentences into a script window, but these are not evaluated. When you press Enter, the cursor is simply moved to the line below. To run a script window, you can either select an execution window and then enter a sentence to load the corresponding script file, or you can run it directly by selecting one of the options from the Run menu or pressing an equivalent Ctrl key:

Window

Ctrl+W

runs script window

Selection

Ctrl+E

runs selected text only

Line

Ctrl+R

runs current line only

File

runs a script file, selecting from the File/Open dialog box

By default, these options are run silently - script output will only display if there is an error. To run the options with display on, hold down the Shift key when you click on the menu option, or press Shift-Ctrl-key.

When you select the Run/Window menu option, the session manager first saves the script as a file (if changes have been made), then loads this file into the session. In some cases, you do not have to switch to the execution window at all - for example if you are developing a Windows application, then you can create and test the parent and child controls directly from the script window.

If you open a script and make changes to it, then you are prompted to save the file when it is closed, or when you first run it as a script.

You can open as many script windows as you wish - all are attached to the same session.