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

samples.NewIn96.add2lines

«this script adds two lines at the beginning of a text file
local (f = "Macintosh HD:testfile")
local (origcreator = file.creator (f))
local (origtype = file.type (f))
local (origcreationdate = file.created (f))
local (s)
file.open (f)
s = string (file.read (f, infinity))
file.close (f)
s = "line 1\r" + "line2\r" + s
file.new (f)
file.setType (f, origtype)
file.setCreator (f, origcreator)
file.setCreated (f, origcreationdate)
file.open (f)
file.write (f, s)
file.close (f)


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