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: Eric Robertson <email@hidden>
- Date: Sun, 28 Oct 2012 11:39:53 +0000
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