Scripting Overview
The scripting language is designed to let you produce a repeatable series of steps for the creation of something interesting.
A script is created by dragging icons from the block on the left into the window
on the right. Each represents an operation of the program. Most of these operations
are already available on the menu bar. Some are only available here. Once placed
in the view, these Icons can be rearranged by first selecting them (using the
pointer setting) either by clicking, -clicking
(for multiple selection), or dragging a selection rect. Once placed in the view
you can connect them together to establish a flow of
execution. This connecting is done by selecting "flow connector" in
the "Mouse modes" box. The cursor will now be a largish white filled
arrow when over the script view area of the window. You can drag a connection
(black line) from one icon to another. When the "start" button is
clicked the script will start execution with the start icon and continuing in
the order specified by these lines.
When the script is executing the icon currently being executed will flash a red boundary. If you select the speed box, the icon being executed will no longer be flashed. This flashing is a time consuming process and the script will go faster.
The script can be made to stepped through slowly by checking the "single step" check box. and then repeatedly clicking "Continue" or pressing the space bar. While this stepping is done you will see that the main window displays the contents of the big array, if it has been changed. When the script is running this annoying flashing is suppressed.
You may make loops, so that parts of the script are repeated many times. You
should plan an exit strategy. If a loop looks to outlast the universe, click
"single step" or type "."
to halt the loop. While a script is in progress you should not be able to delete
an icon or script or close a document. Pause the script first.
A paused script may be edited and then continued. The icon that is highlighted when execution is paused will be the next icon to be processed when continued. Deleting that icon will prevent the script from being continued. You must then restart. However you may wish to make the execution line go directly from "Start" to the point you wish to have execution resume.
Color Codes
The icons as you can see are colored, the color generally loosely delineating a category of operation.
Light blue - save files.
Dark blue - load files
pink - perform an action on the big array.
green - count down, delay, stop, or branch the flow
yellow - display, do logical operations, filter, clip, paste (in many ways),
graph.
orange - the orange icon is for information you want to include in the script.
It can't be connected in the flow of execution.
A description of the actions of each icon is available from the index at the left. They are grouped by color.
Setting up the Icons
Many of the icons however require information from you before they can operate, so before the script can start you must supply this information. You can double click on the icon to open it or wait for the icon to demand attention. This demand is a beep a highlighting of the requesting icon and the presentation of a dialog window. Supply the information. It is usually necessary to hide this dialog before proceeding.
For example the file handling icons (the blue icons on the left) require the
name of a file before they can operate. A window will open and you will be prompted
to find the file to be loaded or supply the name and location for a file to
be saved.
As another example the yellow icon at the top has the job of putting the big
array on the screen. You need to specify what aspect of the big array is to
be displayed.
If you hold the cursor over an icon a hint will be displayed next to describing the function of the icon. When the icon has been dragged to the script view the hint may contain information about the settings. File handling icons, for example, will display the name of the file that has been selected.
Some of the icons can fill some of their fields from symbols of your choice.
The page will have an "Ok Symbol" checkbox. If this is checked additional
checkboxes and yellow text fields will appear. If available, check the box in front
of the yellow field and then fill in some symbol. The current value of the symbol at the time of execution of this icon will be put into the adjacent number field.
The values of these symbols reside in the green "SYMBOL DEFS" icon.
This icon must be included if you choose to use these symbols in other than the "Rescale" icon. It is usually placed
immediately after the start icon. The "Rescale" icon
interacts with the "Symbol Defs" icon and passes values and symbols to and from the table of values. You should read about these icons carefully if you wish to use symbols.
Drag & Drop from the Finder
File icons can be dragged from a Finder window onto the Scripting Window. When the file icon is dropped a script icon of appropriate type will appear in the script window. The icon will already know the name of the file which it will load when execution gets to that icon. All of the file types used by this program can be loaded in this way.
![]() |
A script file icon can be dragged from the finder to the box shown at the left. When dropped the new script will replace any existing script. If you drag the icon from this box to a finder window, a file will be created with the current contents of the script window. |
Saving & Copying
The data that you enter into an icon will be saved with the script. So if you enter information which is not a default setting, the information will be there ready to use when you load the saved script file.
You can clip and paste icons which have been selected using -C
and
-V.
The paste can between windows or to the same window to duplicate the settings
of the icon.
Moving and sending scripts
You will want to send a script to another user. When you do so the path names of the files (i.e. the names of all the nested folders holding the file) will be different. The script will try to resolve these paths starting with the location of the folder holding the script and working outwards, searching for the file name. The search will not go beyond the users home directory. It will look in your trash, however, since this is in your home directory. If the script creates a file the script will look for a folder having an appropriate name to hold the new file. All of these actions to resolve names takes place before execution of the scripts starts. If the results of a moved script seem strange you should roll the pointer slowly over the script icons and see what paths have been give to the the files. You will find that it is good practice to put all the files used by a script in a folder with the script. If you latter send this folder to another computer the script will run without having to re-connect the icons to the files that they are accessing. Excepting of coarce the occasional bug.
Colored Flow Lines
flow connector The black lines determine the flow of execution of the script. Notes can not be linked into the flow. Only one black flow line can originate on an icon, but many can end on an icon.
alt-flow ----The icons shown
here
are able to originate green alternate flow lines. These line become the flow
of execution is certain conditions are met; in the case of the blue icons a
file is not found, in the case of the green icons a count down or calculated
condition is met, in the case of the red icons the branch is taken if a batch
file which is being read is exhausted. If no green alt-flow path is provided,
execution will stop whenever the branch condition is met. Try branching to a
bell.
data flow ----Some icons can
be connected to others by a red data connection. This line can be used to pass
information stored at the first icon to one or more others. The tree data types
passed are Bitmaps (black and white pixel map), big arrays (real and imaginary
parts double precision numbers), text (a list of numbers saved as text).
Bitmaps can originate with
and end on
or originate with
and end on
.
Big array copies can originate with
and end on
.
A data flow connection
may also me made from the
to either another
or to
icons.
Some numerical information can be moved from
to a
by data flow line for use in equations etc.
Not included in the above discussion a data
flow can be made from the to
the
. This will cause
the display icon to redefine the gray levels it displays using the data stored
in the Screen filter icon.
Why are there three ways to calculate propagation?
The icons and icon combination shown here or
or
are all used at various times to calculate the propagation of light.
The go-to method for me is the direct propagation which takes into account the pixilation of an assumed light valve. It is good over almost all distances. It is however slow and slows down calculations if included in a loop. The input and outputs can have wildly different scales by just changing the pixel pitch. If you want to zoom in on a particular spot just change the pixel pitch and offset the center. Since it assumes a rasterized light source using the output of one step as the input of the next degrades the quality of the calculation. Don't do it. [much]
The chirp function (Fresnel transform) is very fast and can be chained. Propagation over large distances will permit spreading light to wrap around to the other side of the screen. (this is because of the internal use of Fourier transforms which are computed on a toroidal support.) So, you must use this with smaller steps. The magnification is limited with this.
The three icon combination is equivalent to the Fresnel transform of the chirp but gives no magnification. I use this mostly when simulating propagation down a fiber. Again, only use in small steps. The lens function in the center must be used in the "duel" mode.
About the "Read Me" icon
I have a hard drive full of scripts which are inadequately documented and, therefore, hard to figure out how to use. I want to urge you to be more disciplined than I am myself. Always include one or two Read Me's in your script. You can drag an orange line from the "Read Me" icon to any other icon as a pointer. This line has no effect upon the operation of the script. These scripts take very little disk space, so if you can make several scripts with variations, include a good explanation of their use and give them descriptive names.