Appendix A. Installing and Running LynPlex

Obtaining LynPlex

Download the latest version of LynPlex.


In the following notes it is assumed that the file type of an LynPlex file is “.plex”. This will normally be used to identify LynPlex files, but is an installation option. Short forms can be used but as they may conflict with existing file types, this is also an installation option.

Windows Installation

File Association

The next step is to associate the file type “.plex” with the LynPlex interpreter. Open a command window and enter:

assoc .plex=Plex.script

This defines file type to associate with “.plex”.

In order to associate this file with the LynPlex interpreter enter:

ftype Plex.script=LynPlex "%1" %*

Whenever you run a program with a type of .plex it will pass it to the LynPlex interpreter. Any other options that you enter in a command line will be included.

To ensure that the LynPlex program will be found you need to enter something like.

path C:\usercmd;%path%


path %path%;C:\usercmd

where “C:\usercmd” is the folder where you have unzipped LynPlex. The first version will cause your folder to be searched before the existing folders in the path. If you do not want this to happen use the second version.

Automatic Execution

It is possible to set up LynPlex files to run automatically by just entering the file name.


Displays or modifies file extension associations

assoc [.ext[=[fileType]]]

Specifies the file extension to associate the file type with
Specifies the file type to associate with the file extension

Type assoc without parameters to display the current file associations.

If assoc is invoked with just a file extension, it displays the current file association for that file extension.

Specify nothing for the file type and the command will delete the association for the file extension.


Displays or modifies file types used in file extension associations

ftype [fileType[=[openCommandString]]]

Specifies the file type to examine or change
Specifies the open command to use when launching files of this type.

Type ftype without parameters to display the current file types that have open command strings defined.

If ftype is invoked with just a file type, it displays the current open command string for that file type.

If you specify nothing for the open command string, the ftype command will delete the open command string for the file type.

Within an open command string %0 or %1 are substituted with the file name being launched through the association. %* gets all the parameters and %2 gets the 1st parameter, %3 the second, etc. %~n gets all the remaining parameters starting with the nth parameter, where n may be between 2 and 9, inclusive. For example:

assoc .plex=Plex.script
ftype Plex.script=LynPlex.exe %1 %*

would allow you to invoke a LynPlex script as follows:

script.plex 1 2 3

If running under Windows XP, 2000 or Vista it is possible to set up LynPlex files to run automatically by just entering the file name without the “.plex” extension.

To do this set the pathext system variable to include “.plex”. Enter:

set pathext=.plex;%pathext%

and the script could be invoked as follows:

script 1 2 3

Note that by putting “.plex” at the front of the list in PATHEXT, LynPlex files run in preference to other files of the same name but of different types. This can be used to effectively intercept any command. The executable file with the same name can then be run from within a LynPlex script.

Running LynPlex

If you have set up automatic execution, you can type in a Plex file name at a command prompt. The program will run as if it is a system command.

To be implemented. There are also more advanced ways to run a program with LynPlex. For example, type a program that prints out LynPlex commands!

PUT "PUT 3/4"

Now, run it by using | (pipe) symbol.

> lynplex myprog | lynplex

This is very simple. The first lynplex runs myprog.plex. This program puts out the line PUT 3/4. The second lynplex runs the result of the first lynplex which was the code PUT 3/4.

Command line parameters

The following command line parameters are used by LynPlex. All parameters are identified by prefixing them with either minus (-) or slash (/). Any word in the command line that is not prefixed is passed through to the script.

All parameters may be either upper or lower case.

-- or //
Anything following this is passed through to the script unchanged. This option can be used to pass prefixed parameters to the script.
Pause at the end of execution.
If a script starts in a new window and writes output, without this option the window may be closed before the output can be read. This option cause a pause message to be displayed before continuing.
Verbose option.
This causes extra information to be displayed during both translation and execution.
Help option.
Displays the command line help.

Windows Scripts

To be implemented.

Unix script executables

To be implemented.

In Unices we can create script executables. Those script are working similar to the common executables.

We need only two things.

a) A line at the beginning of our program

#!/usr/bin/lynplex -q 

b) And to set the executable attribute of the file

# chmod 0777 myprog.plex 

Now we can run it as usual.

# ./myprog.plex
Hello, world!

We can find more on scripts, paths and Unix attributes on Unix manuals.

lynplex/lp0a.txt · Last modified: 2012/09/08 15:23 (external edit)