• 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: Open for access with write permission
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Open for access with write permission


  • Subject: Re: Open for access with write permission
  • From: Vince Angeloni <email@hidden>
  • Date: Thu, 22 Mar 2007 20:14:27 -0500

Hi Michelle,


set eof of fileRef to (get eof of fileRef) + 1
write additions to fileRef
close access bar

Why are you opening into fileRef, but closing bar? They should be the same variable.

Typo; I forgot to change it. The script never got that far so it never erred there.

The fact that the script never got to the "close" statement is most likely the problem. It is leaving the file open when it errors. I will usually wrap my write statements in a try handler like this, just in case:

set the_file to (choose file name with prompt "Choose a name and location for your text file.")
try
set file_pointer to (open for access the_file with write permission)
write "Your text here" to file_pointer
on error
close access file_pointer
end try
close access file_pointer

To get out of your current predicament, I'd suggest opening a *new* script, and just run 

close access "path:to:file"

and see if that closes it. Then rewrite your write handler as above and you should be good.

HTH, 
Vince
 _______________________________________________
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

  • Follow-Ups:
    • Re: Open for access with write permission
      • From: Michelle Steiner <email@hidden>
  • Prev by Date: Re: Open for access with write permission
  • Next by Date: Re: Open for access with write permission
  • Previous by thread: Re: Open for access with write permission
  • Next by thread: Re: Open for access with write permission
  • Index(es):
    • Date
    • Thread