Invalid use of Delete

Hello, all–

I copied the following code from another (working) script:

set tokens to ( "%%Title:", "%%Creator:", "%%CreationDate:" )

put file thefile into old
replace all cr with lf in old
repeat with each line of old
	if the first word of it is in tokens then delete it
end repeat

When I run this, I get the following error/output:

>>> 03:15:09 Start handler 1: compare
set tokens to ( "%%Title:", "%%Creator:", "%%CreationDate:" )
	repeat with each file of the files of "/Users/afisher/Desktop/a"
		if the name of file does not contain ".eps" then next repeat
		put file file into old
	replace all cr with lf in old
	repeat with each line of old
		if the first word of it is in tokens then delete it
	end repeat
	repeat with each line of old
		if the first word of it is in tokens then delete it
<<< 03:15:15 End handler 1: compare (aborted)
Thu, 10/30/08 3:15:16 PM	FAILURE		STInvalidCommand Improper use of delete command on %%Title: EPSBaseline.mus
Execution Time 0:00:06 Compare.script

Any ideas as to what might be happening?

Just figured it out:

This:

set tokens to ( "%%Title:", "%%Creator:", "%%CreationDate:" )
put file thefile into old
replace all cr with lf in old
repeat with each line of old

Shoulda been:

set tokens to ( "%%Title:", "%%Creator:", "%%CreationDate:" )
put file thefile into old
replace all cr with lf in old
repeat with each line of old by reference

Sorry to be a pain. :oops:

No problem, Allen. Glad you figured it out. I was just about to investigate when I saw you had it working.