Re: Check if a file exists fails
Re: Check if a file exists fails
- Subject: Re: Check if a file exists fails
- From: Ed Stockly <email@hidden>
- Date: Sun, 6 Jan 2008 12:17:53 -0800
I'm working on a small Folder Action Script, whose second line looks like (exactly how I learned from the AppleScript Language Guide):
if (the file ":Index" exists) then
Bernhard,
:Index
Is not a valid file reference, which may be why you're getting that particular error.
AppleScript needs the full path:
file "hdName:dir:filename"
works, but
file ":filename"
won't work.
Also, the most reliable way to determine if a file exists in appleScript is to attempt a coersion to alias: try set myFile to "hdName:dir:filename" as alias set fileExists to true on error set fileExists to fale end try
HTH,
ES
=
|
_______________________________________________
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