Part of the Samples Website. 8/16/97.

samples.basicStuff.textSort

«Sorts a text file using the quick sort in Frontier's outliner
«run samples.basicStuff.writeTextFile first to create the sample file
local (f = file.getSystemDisk () + "textfile")
local (fileType = file.type (f), fileCreator = file.creator (f))
local (outline)
file.open (f)
s = string (file.read (f, infinity)) «read the whole file into the string
file.close (f)
clipboard.putValue (s)
new (outlineType, @outline) «create a temporary outline
edit (@outline)
editMenu.paste ()
op.firstSummit ()
op.deleteLine ()
op.sort ()
editMenu.selectAll ()
editMenu.copy ()
s = clipboard.getValue ('TEXT')
file.new (f)
file.setType (f, fileType)
file.setCreator (f, fileCreator)
file.write (f, s)


This page was last built on Sat, Aug 16, 1997 at 6:41:41 PM. You can download the current set of sample scripts from our FTP site. Dave