Launching Script Editor Locate the AppleScript folder and open Script Editor. Choose File > Open Script. Search for the Canvas folder and then the Scripts sub- folder. Within the Scripts subfolder, open the script entitled Down- sample. The script will appear in the bottom pane of the Script Editor. The first line of the script indicates its purpose: -- This script will downsample a file con- taining a high resolution image to 72. In AppleScript, a command or a set of commands for a specific appli- cation begins with the word tell and ends with end tell. The first command launches Canvas and opens a new illustration file: tell application "Canvas™ 8" make new document with properties {document type:illustration} end tell The next command launches Finder so you can select the source and destination folders. Also, the number of files in the source folder are counted: tell application "Finder" set myFolder to choose folder with prompt "Select source folder:" set myResults to choose folder with prompt "Select destination folder:" set nFiles to count folder myFolder each file end tell The following command begins with repeat since it is to be repeated on each file that is found in the source folder. This command indicates that Canvas is to open each image file in the source folder, set the image resolution to 72 ppi, rename the file, and save it to the destination directory. repeat with i from 1 to nFiles tell application "Finder" set f to file i of myFolder set fName to get name of f end tell tell application "Canvas™ 8" Scripts folder Canvas folder
Canvas 8 Help: Writing Scripts for Canvas (15 of 16)                                                Page #757