This is a child page. You can use Parent in the quick nav bar at the top or the bottom of the page to navigate directly back to the parent of this page. Some child pages are more than one level deep, and in that case will require more than one Parent click to reach the outermost document level.

16.96 - WIS Scripts


F/x uses a language similar to BASIC to allow you to write custom script operators that use F/x's in-built image processing operators. If you're interested, you can even write your own operators. The only thing to keep in mind is that because the scripting language is interpreted, any direct script-based manipulation of images will be quite slow compared to F/x's own image manipulation, or manipulation performed by a plug-in. (Did that get you interested in plug-ins? You'll find plug-in developer information here)


Operator Dialog

16.96.1 - Script Controls

16.96.1.1 - Path & Script File

Together, these hold the information regarding the location of the script. "Script File" contains the actual name of the script. "Path" contains the directory in which the script is contained.

16.96.1.2 - Browse

Browse allows you to search your computer for the location of the script.

16.96.1.3 - Edit

Edit allows you to edit the script with F/x's built-in quick edit window.

16.96.1.4 - New

New opens up the quick edit window and allows you to save your new script.

 Note:

F/x's quick edit window will only keep up to 64000 characters. Files in excess of 64000 characters must be done with an outside text editor.

16.96.1.5 - Key Features

  • Allows multiple statements per line (separate statements with a ":")
  • Conditional execution ( WHILE ,  IF - THEN - ELSE )
  • Iterative execution ( FOR - NEXT - STEP )
  • Subroutine and jumping structure ( GOSUB ,  RETURN ,  GOTO ,  ON-GOTO ,  ON-GOSUB )
  • Random numbers ( RND() )
  • Scripts work directly (and automatically) with user area selections, including anti-aliasing
  • Scripts can access image and transparency data directly ( GETRED() ,  PUTBLUE() ,etc.)
  • Scripts can access palettes directly ( GETPALETTE() ,  SETPALETTE() )
  • Scripts can access profiles directly ( GETPROF() ,  SETPROF() )
  • Allows REMarks, completely blank lines and arbitrary indentation for clarity
  • Supports progress bar indication, and allows aborting the script via user pressing STOP in F/x
  • Provides "Stack-oriented" operations for masks
  • Provides "Stack-oriented" operations for images
  • Work directly in Timelines, just like "normal" operators
  • Allows using the position of the Timeline to calculate variables ( TLPOS() ,  TPOS() )
  • Very similar to BASIC, very easily learned
  • Supports all WinImages operators that affect image pixels
  • Over 70 BASIC language commands and functions, over 150 WinImages commands and functions
  • Catches and reports many types of syntax and programming errors at run time
  • Any number of scripts may be maintained in external .WIS files
  • Scripts may contain up to 32,000 lines of code
  • Built-in "mini-editor"

16.96.1.6 - Where do scripts go?

Each .WIS script is a file. You create them with either the built in editor (for scripts up to 64000 characters) or an external text editor for extremely large scripts.

Scripts are normal ASCII text. The filename should have the extension .WIS

The name of the script will be saved when dragged into the TimeLine, this means that different scripts can be used in different frames in the timeline.

16.96.1.7 - How it Works

.WIS scripts are executed as operators. This means that they go to work when you make an area selection on an image.

In response to the area selection, F/x calls the script, which can then in turn call F/x requesting one or more functions that will work on the area selection.

Or, the script can "talk to" F/x directly, learn where the area selection is, and then process the image data directly. That means that almost any kind of filter or effect imaginable can be created, given the time, energy and incentive.

From the script-user's standpoint, all that needs to be done is select a pre made script, and make an area selection. The script does the rest.

From the script-writer's standpoint, the script can be anything from one line, like this:

10 A=ANNULAR(64,64,255,0,1)

...to almost any complex combination of features and functions and calculations you can imagine. You can find examples of scripts at various levels of complexity here.

16.96.1.8 - An Introduction to Scripting Syntax

.WIS scripting is very similar to the BASIC language. If you're familiar with BASIC, then you should have no trouble at all with F/x's scripting. If you're not familiar with BASIC, then you can either hunt down some tutorial information on the BASIC language (there are lots of these on the web) or you can jump right in and see what you can learn by "winging it." To do that, read the section that follows, and then look over the examples.

The reason we chose BASIC as the model for our scripting language is that BASIC is very easy to learn, in fact it is probably the easiest programming language there is, yet it still provides a great degree of power and flexibility to the user. With that in mind:

In F/x, scripts execute in response to the user making an area selection on an image. The script may issue commands to F/x, causing a predefined function to run, or it may operate directly on image data. The area selection that the user made will control what portions of the image that the script may modify; however, the script may read from any portion of the image, or of the undo buffer which will contain an unmodified copy of the image during the entire script operation. Scripts may access image pixel data as either RGB or HSL entities; you can even access a pixel both ways at the same time. This allows you to process the pixel in a number of useful ways.

16.96.1.9 - Skeletal Syntax Issues

Each line in a .WIS script file must begin with a line number. Line numbers are integers from 1 to 32000.

A line may contain one or more statements; when more than one statement is contained in a line, each statement is to be separated by a colon (:).

Blank lines are allowed.

Any number of spaces and/or TAB characters may be entered around line numbers.

Numeric variables are named using one or more alphanumeric characters, with the rule that they must start with an alphabetic character. Numeric variables are case-sensitive; the variable  A  is not the same as the variable  a . All numbers are floating point numbers; when an integer is required by F/x, the fractional part, if any, of a number is simply discarded.

Text variables are named using one or more alphanumeric characters followed by the dollar sign ( $ ), with the rule that they must start with an alphabetic character. Text variables are case sensitive; the variable  A$  is not the same as the variable  a$ .

Multiply-dimensioned variables of either type may be created with the  DIM  statement.

In the case of both numeric and text variables, names longer than one character are allowed, as long as those names are not the name of any command, function or keyword in the scripting language. For instance, a variable named "peak" is ok, but a variable named "print" is not ok.

The  PRINT  statement, while in most ways similar to PRINT in standard BASIC, sends output to a dialog within F/x. This allows you to send messages to the user during script execution.

Keyboard Navigation
, Previous Page . Next Page t TOC i Index o Operators g Glossary
WinImages F/x, Morph and all associated documentation
Copyright © 1992-2007 Black Belt Systems ALL RIGHTS RESERVED Under the Pan-American Conventions
WinImages F/x Manual Version 7, Revision 6, Level A

Valid HTML 4.01 Loose
 

This manual was generated with wtfm
wtfm uses aa_macro and SqLite
aa_macro uses python 2.7
Page 259