• 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: If folder does not exist ...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: If folder does not exist ...


  • Subject: Re: If folder does not exist ...
  • From: Steven Angier <email@hidden>
  • Date: Wed, 12 Jun 2002 09:56:22 +1000

On 12/6/02 9:29 AM, "JollyRoger" <email@hidden> wrote:

> on FileExists(someFile)
> try
> set anAlias to (someFile as alias)
> return true
> on error
> return false
> end try
> end FileExists
> --end script

That's good, except that FileExists() might fail if you feed it an alias
instead of a path string. (A broken alias is still an alias.)

If you add a text coercion before the alias coercion, then feeding it a
broken alias will return the right result, thus:

on FileExists(someFile)
try
get (someFile as text) as alias
return true
on error
return false
end
end


>
> In many cases, asking the Finder to do something is much, much slower than
> the alternative.

And often less reliable.


Steven Angier
Macscript.com
_______________________________________________
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.

  • Follow-Ups:
    • Re: If folder does not exist ...
      • From: JollyRoger <email@hidden>
References: 
 >Re: If folder does not exist ... (From: JollyRoger <email@hidden>)

  • Prev by Date: Re: If folder does not exist ...
  • Next by Date: Re: If folder does not exist ...
  • Previous by thread: Re: If folder does not exist ...
  • Next by thread: Re: If folder does not exist ...
  • Index(es):
    • Date
    • Thread