• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Close access file question ...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Close access file question ...


  • Subject: Re: Close access file question ...
  • From: email@hidden
  • Date: Mon, 12 Aug 2002 16:00:05 -0700

You want to set up try/on error/end try blocks that catch errors and close
your files. It's a bit of work to set up, but it's really how the script
should work.

for instance:

set theFile to ""
try
set theFile to open for access "/path/to/file" with write permission
--access theFile
--do something that crashes
close theFile
set theFile to ""
on error
if theFile is not "" then
close theFile
end if
end try

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Seth A. Roby
Scriptwriter Intern
"Life is like an exploded clown. It's really funny until you figure out
what just happened."



Charles Heizer
<email@hidden> To: Michelle Steiner <email@hidden>
Sent by: cc: <email@hidden>
applescript-users-admin@list Subject: Re: Close access file question ...
s.apple.com


08/12/2002 03:35 PM






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?

- Charles


On 8/12/02 2:23 PM, "Michelle Steiner" <email@hidden> wrote:

> Thankfully no. It would close files that have been opened by other
> applications, and that would not be a good thing.
>
> --Michelle
>
> On Monday, August 12, 2002, at 01:59 PM, Charles Heizer wrote:
>
>> Is there a simple, global or something/someway to close access to any
>> file
>> which may be open for access?
> We're not human beings having a spiritual experience.
> We're spiritual beings having a human experience.
> _______________________________________________
> 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.
_______________________________________________
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.
_______________________________________________
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.

  • Prev by Date: Re: Close access file question ...
  • Next by Date: making a script wait until a task finishes before proceeding
  • Previous by thread: Re: Close access file question ...
  • Next by thread: Re: Close access file question ...
  • Index(es):
    • Date
    • Thread