• 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: Alias Forms as Property (Was: Applescript-users Digest, Vol 1, Issue 177, Message 3)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Alias Forms as Property (Was: Applescript-users Digest, Vol 1, Issue 177, Message 3)


  • Subject: Re: Alias Forms as Property (Was: Applescript-users Digest, Vol 1, Issue 177, Message 3)
  • From: Jonathan Levi MD <email@hidden>
  • Date: Sat, 6 Nov 2004 00:20:00 -0500

On Fri, 05 Nov 2004 09:29:51 -0800, Paul Berkowitz <email@hidden> wrote:

 ...If you save the alias form as a property, then the user can
move the file around, rename it, and so on, and the script still finds the
file. (There is a liability though: if the file has been deleted, the
property declaration causes an error _even if_ you think you have prepared
for this case by a try/error block to get the alias in the script...

As a mostly-lurker to this list, I hesitate to put in a word before this august company; however, my solution to the above has been to save the path as a string (could be Unicode text, I suppose) then at the start of a script, have this try block:

on verifyPath()
  try
    alias <the path property>
  on error
    set <the path property> to ((choose file with prompt ¬
      ("Can't locate "" & <file name> & ¬
        "". Where is it, please?")) as string)--or Unicode text(?)
  end try
end verifyPath

It's proven useful enough times that I've rewritten it as an independent script, to to be called with a reference to the path property and code to prompt for either a file or a folder as necessary. (Instead of taking a reference, it could accept the path itself, then return a value: original path if OK, new path if not.) --Jonathan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: Alias Forms as Property (Was: Applescript-users Digest, Vol 1, Issue 177, Message 3)
      • From: Paul Berkowitz <email@hidden>
  • Prev by Date: Re: HTML and Applescript?
  • Next by Date: Re: Alias Forms as Property (Was: Applescript-users Digest, Vol 1, Issue 177, Message 3)
  • Previous by thread: Re: HTML and Applescript?
  • Next by thread: Re: Alias Forms as Property (Was: Applescript-users Digest, Vol 1, Issue 177, Message 3)
  • Index(es):
    • Date
    • Thread