read file subroutine fails every second time
read file subroutine fails every second time
- Subject: read file subroutine fails every second time
- From: MB <email@hidden>
- Date: Sun, 13 Apr 2008 15:42:03 +0200
I'm trying to make a reader subroutine to use in one of my email scripts
and other places, with the objective to move the content of attached
HTML files to the HTML Content of the message in application PowerMail.
First time I run this test of my reader() subroutine it works as
expected, but the second time it gives me a EOF error (-39). How can I
avoid end of file errors in this context?
***The Reader Script
on run
choose file
set theFile to result
set theContent to my reader(theFile)
-- the main parts only with the call for brevity
end run
on reader(theAlias)
try
open for access theAlias
on error
display dialog "Couldn't read file " & theAlias
return
end try
repeat
try
set theFileText to (read theAlias before (ASCII character of 30)
using delimiter (ASCII character of 28))
return theFileText
on error myErrMsg number myErrNo
close access theAlias
exit repeat
end try
end repeat
end reader
***End of reader Script
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden