LJ /sp

Activation: assign to an LJ menu item; then select from there.

This macro requires Tom Brodhead’s “LJ” program in order to function.
Note that this macro requires the presence of an LJ “ini” file. Mine has this content:

/lj /p s:\score4\lj\lj.prf /cd2 /n /autoselect

Make sure that the ini file is placed in the directory where your copy of the LJ program resides.

Details of this macro:

This macro subjects an open file to the LJ /sp procedure. “sp” stands for “system prompt,” which means that the LJ program, when executed with the /sp switch, will prompt the user for information about which systems are to be spaced. For this reason, this macro functions differently from LJ /autoselect (for instance). A macro such as LJ /autoselect calls LJ in the background, which performs its function and then terminates. When LJ is invoked with a switch such as /sp, waiting for user input, it must by definition not self-terminate.

In order to allow the user to answer the system prompts generated by LJ, I debated capturing the prompts and issuing them in dialog boxes. Ultimately, I decided against that approach as unnecessary. Instead, the prompts appear on the command line, as they ordinarily would, and the user answers the prompts from there. The difference from running LJ in the “conventional” way (i.e. by exiting and invoking it from the command prompt) is that the command prompt is invoked automatically, the open file is automatically recognized, and the /sp switch has already been piped into LJ. As a result, when executing this macro, the user need only indicate the systems he/she wishes to space.

I invoke my LJ /sp macro from an LJ menu item:

Before the procedure is executed, the following prompt appears, allowing the user to abort:

Once you proceed, a command prompt opens instantly:

Note that the command prompt automatically processes the open file (in this image, AAAA.MUS), and that the user is immediately prompted for the system(s) he/she wishes to space. Indicate the desired systems; follow the prompts. Once you are done, the command prompt will close automatically, the desired systems have been respaced, and the following prompt appears:

You may wish to examine the results before responding to this prompt. If you are not happy with the results, or if you inadvertently subjected the file to this procedure, click Undo, and the pre-LJ/sp state of the open file is reinstated. If you are happy with the result, click Accept.

If LJ.exe encounters an error during operation, the command prompt provides details of the encountered error:

In this case, you’ll have to exit LJ (follow the prompts), take the corrective action in the Score file itself, and then invoke this macro again. It is not sufficient to keep the LJ session open, switch over to the Score file, correct the mistake, and then attempt to process the system again. That is because the file content that LJ is processing resides in RAM, and any revisions you undertake on the open file are not recognized by LJ, until the revised file is fed into LJ again.

This macro can be used as a model for any LJ.exe procedure that performs an operation while asking for further user input (as opposed to a procedure such as executing LJ.exe with the /autoselect switch; see the details on that page). Instructions on how to do this in a matter of minutes can be gleaned on the Notes tab in the macro:

Within Macro Express, position this macro into the LJ category:

To see this macro in action within ScorBox, have a look at this video:

Posted by Jürgen Selk

initial posting:  4 April 2011

Download file:


The download file contains the following:

Macro Express module:

  • LJ /sp [LJ]