|
|
|
|
||||||||
|
Creating a Script The easiest way to create a PaintletScript is to use the psl editor (shown below), but no matter how a script is created, the first tag is <PAINTLET> and the last tag is </PAINTLET>. All other tags are enclosed by these two. Next up is the header section. Within the <HEAD> </HEAD> tags are <TITLE>, <AUTHOR>, <DATE> and <DESCRIPTION>. This information will be displayed in a small pop-up window before the script begins to execute. After the header section is the context. The <CONTEXT> tags enclose the initial settings for Paintlet. The <PAINT> tag sets the initial paint color, transparency, fill style and gradient. The <BRUSH> tag simply sets the width to 1 pixel. The <CANVAS> tag sets the paintable canvas to its maximum (default) size. The first paintable tag in the Hello script is <BACKGROUND/>. This tag paints the entire canvas in the current paint color, which is white. Notice that the <PAINT> tag in the context section specified the color as an rgb value. The r is the red color component, g is green and b blue. Each can be a number from 0 thru 255, so 255,255,255 is the maximum possible value (white). After the background is the opening <TEXT> tag. The x and y parameters specify where on the canvas the text will be drawn. Before the closing text tag </TEXT>, style tags are added. In this case, a <FONT> is specified. The possible font names that are available depend on the computer's operating system, but these fonts will always work:
A <TEXTPAINT> tag is added to specify the color of the text. The PaintletScript color constant red is used, rather than an rgb value. The text to draw is specified. Finally, the closing </TEXT> tag, followed by the closing </PAINTLET> tag. Running the script produces the following on the canvas:
|
||||||||
|
||||||||
|
Using the psl Editor The simple Hello PaintletScript can be created in just a few minutes using the psl editor shown below. Start with a clean text area by pressing the clear button. There are five rows of buttons at the bottom of the editor. Each of these buttons correspond to a PaintletScript tag (or tags). When the mouse hovers over a button, a tooltip will pop up which identifies its tag. The first button in the first row (T) will print a script template with the opening paintlet tag, followed by the header and context sections. Fill in the blanks for the script title, author and description. Now find the background tag and click it. Then the text tags, and finally the closing paintlet tag. Be sure to type in the text to be drawn to the canvas. Click the save button and give the script a name. A window will pop up and show the location of the saved script file, which will be the ptScript folder. |
||||||||
|
||||||||
|
Running a Script Paintlet will create a ptScript folder from the directory in which it's running. All scripts created with the editor will be saved there. The editor has a list of scripts in the ptScript folder. Select one from the list. Press the load button, and the script will open in the text area. Make changes to the script in the text area if you wish, then press play. Before the script starts executing, a pop-up will display the header information. Then the script will begin. The script will run until completion, or until the stop button is pressed. If the animated JJJ button in the upper right corner of Paintlet is moving, the script has finished. |
||||||||
|
Notes
|
|
|
|