-- This is an example AppleScript showing how to use a -- scriptable text editor with MathPad to print a -- plot for each data file in the given folder ------------------------------------------------------ -- routine to insert a read statement into the MathPad document on InsertRead(MPDoc, dataname) tell application "Scriptable Text Editor" open MPDoc select paragraph 1 of document 1 delete selection set selection to "data=read(\"" & dataname & "\")" save document 1 as text in MPDoc close document 1 saving no end tell end InsertRead tell application "Finder" activate -- prompt for an existing MathPad document that plots the array "data" set MPDoc to choose file with prompt "Select the plot routine" -- prompt for a folder containing only data files set datafolder to choose folder with prompt "Select the data folder" repeat with dfile in datafolder InsertRead(MPDoc, dfile as text) of me select MPDoc print selection end repeat end tell