IRIS TUTORIAL
Console commands and scripts

 

The full set of console commands is described here

Iris implements the possibility to run a succession of commands from a script file in text format. This script file (or batch file) must mandatory have the extension "pgm", for example "myprogram.pgm". Scripts is running with RUN command from the console.

The "batch" mode is very elementary. The execution is strictly linear. It is not possible to carry out conditional tests or loops for examples. The script is thus not a true program, but the process can help for repetitive tasks

The minimal parameter of RUN command is the name of the batch file (the extension is not required). If no path precedes the file name, Iris search the file into the working directory.

The batch name can be followed by optional parameters which are provided to the script file. It is possible to pass up to 5 parameters by this method. In the script file, the first agument is identified by the item "$1", the second parameter by the item "$2", and so on.

For example, a script file which produces an effect of gradient ("bas-relief") in an image with a variable force can be writen

load $1
trans $2 $3
save tmp
load $1
sub tmp 0
visu 200 -200

Edit the file with a word processing software, and save the result under the name test.pgm in the working directory.

From the console, enter the command

>RUN TEST M51 1 1

The script which is executed is then equivalent to the typing:

load m51
trans 1 1
save tmp
load m51
sub tmp 0
visu 200 -200

You can easily start again the batch by positioning cursor prompt on the command line and by modifying one or more parameters. For example

>RUN M51 TEST 2 0

The hundreds of Iris command can be used in a script "pgm" file:

load $1
scale 3 $2 $2
mirrorxy
...

Some commands require to define an area on the current displayed images. Just before this command, add in the script file the command PROMPT. PROMPT freeze the execution of the batch file and open a "Prompt" dialog box. Select the area of the image, then, click the "OK" button of prompt dialog box. For example

load m51
prompt
window3 200

In this example, during prompt, define a rectangle with the mouse. Iris crop a 200x200 pixels zone of the images M51 centered on the selected area.

PROMPT command is also useful for step-to-step run of the script.

You can also add comment into the script file. If the first word of a sentence is not a valid command, the corresponding line is a comment line. For example

==========================
My program load Messier 51
==========================
load m51
End of my program
 


INDEX