Re: Close access file question ...
Re: Close access file question ...
- Subject: Re: Close access file question ...
- From: "Marc K. Myers" <email@hidden>
- Date: Mon, 12 Aug 2002 22:57:14 -0400
- Organization: [very little]
>
Date: Mon, 12 Aug 2002 15:35:45 -0700
>
Subject: Re: Close access file question ...
>
From: Charles Heizer <email@hidden>
>
To: Michelle Steiner <email@hidden>
>
CC: <email@hidden>
>
>
Huh,
>
Here is my problem then. I'm developing a couple of scripts that error out
>
while a file is open for access. Once they are open for access I can't do
>
anything with them until I reboot. Is there a way around this?
After you open a file, put everything in a try...on error block through
the command that normally closes it. That way, if anything goes wrong
it will be captured. In the "on error" section close the file and deal
with the error.
set fileID to (open for access file filePath with write permission)
try
set eof fileID to 0
write theText to fileID starting at eof
close access fileID
on error m number n
try
close access fileID
end try
error m number n
end try
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[8/12/02 10:55:43 PM]
_______________________________________________
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.