• 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: Checking on the existence of a file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Checking on the existence of a file


  • Subject: Re: Checking on the existence of a file
  • From: Eric Robertson <email@hidden>
  • Date: Sun, 28 Oct 2012 11:39:53 +0000

On 26 Oct 2012, at 17:53:50 , email@hidden wrote:

Le 26/10/2012 à 18:40, Eric Robertson <email@hidden> a écrit :


Thanks for these alternative ways of using 'exists' which I've taken a note of - I see all of them use either Finder or System Events.

Eric.

In fact, I don't remember who described an alternative which doesn't require triggering Finder of System Events.

It's :

try
"Macintosh HD:Users:trucmuche:Desktop:machinChose.pdf:" as alias
set isAvailable to true
on error
set isAvailable to false
end try

but, Christopher Nebel from AppleScript Engineering warned us several times against this scheme.
It's only to underline these warnings that I repeat it here.

It was Axel who suggested the following, which didn't seem to trigger either Finder or System Events, and didn't use an 'on error'

tell application "TextEdit"
tell (make new document)
set its text to "This is sample text"
close saving in POSIX file "/Users/ericrobertson/Documents/New Notes.rtf"
end tell
quit
end tell

I assume it's the use of 'on error' that's deprecated in the circumstances you show above because some other error might cause it to be triggered?


Yvan KOENIG (VALLAURIS, France) vendredi 26 octobre 2012 18:53:38

Eric.

 _______________________________________________
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: Checking on the existence of a file
      • From: "koenig.yvan" <email@hidden>
  • Prev by Date: Re: Time anomaly
  • Next by Date: Re: Time anomaly
  • Previous by thread: Re: Checking on the existence of a file
  • Next by thread: Re: Checking on the existence of a file
  • Index(es):
    • Date
    • Thread