Re: Closing Files That I Left Open
Re: Closing Files That I Left Open
- Subject: Re: Closing Files That I Left Open
- From: Nathan Day <email@hidden>
- Date: Sat, 3 Aug 2002 23:32:46 +0930
You should use a try block, something like
try
-- open and read file
on error anMessage number aNumber
-- close your file and do anything any other clean up
error anMessage number aNumber -- include this line if you
want to rethrow the error
end error
if you don't re-throw the error then you script will continue on, the
code in the error block is only executed if an error occur. You can also
not supply the error catching part like.
try
-- open and read file
end try
-- close your file and do anything any other clean up
an error will the just cause the try block part to end
On Saturday, August 3, 2002, at 04:19 AM, email@hidden wrote:
So I'm learning AppleScript
What I'm working on right now opens and writes files, reporting on what
the
script is doing
But sometimes I get errors, and that means that the files don't get
closed
properly.
So when I next try to open the file, I get an error that it's in use. I
know that I should be closing the file in my "on error" blocks, and I
am,
but I'm still trying to find all of the times when I need to do that.
So my question is... how can I release the file from the previous run of
the script without a logout/login cycle? Does anyone know of any OSX
utilities that will let me do this?
Nathan Day
http://homepage.mac.com/nathan_day/
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.