Re: Checking on the existence of a file
Re: Checking on the existence of a file
- Subject: Re: Checking on the existence of a file
- From: Axel Luttgens <email@hidden>
- Date: Thu, 25 Oct 2012 00:20:31 +0100
Le 24 oct. 2012 à 17:55, Eric Robertson a écrit :
> [...] I am now using TextWrangler to save away the details!
Hello Eric,
Are those details just made of plain text?
In which case it could well be that you don't need to make use of an application at all...
> I thought I could use 'exists' to find out if the file I wanted to use was already there but I couldn't find out how to do this.
Perhaps could you download this one:
https://developer.apple.com/library/mac/documentation/AppleScript/Conceptual/AppleScriptLangGuide/AppleScriptLanguageGuide.pdf
While possibly not the most up to date wrt the latest changes in the OS, that document still remains invaluable; for example:
"Third-party scriptable applications also provide commands you can use
in scripts. Many support all or a subset of the Standard commands,
described in Technical Note TN2106, Scripting Interface Guidelines.
These include commands such as delete, duplicate, exists, and move,
as well as application implementations of AppleScript commands,
such as get and set."
The "exists" command is thus supposed to be supplied by an application (ie its handling isn't provided by AppleScript itself).
Yvan already has suggested to make use of the exists command from System Events.
In addition, Luther mentioned the Finder as providing an exists command (with some restrictions).
That said, the approach relying on a try block around a coercion of an HFS path into an alias has often been used as well.
HTH,
Axel
_______________________________________________
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