Re: The Save command will replace, without asking
Re: The Save command will replace, without asking
- Subject: Re: The Save command will replace, without asking
- From: Dave Lyons <email@hidden>
- Date: Fri, 7 Oct 2005 18:39:53 -0700
On Oct 7, 2005, at 2:30 PM, Robert Poland wrote:
set targetfolder to "iMac HD:Users:rpoland:Desktop:"
...
if myfilename is in name of files of targetfolder then
-- error here Can't get every file of "iMac HD:Users:rpoland:Desktop:"
Any clues?
The trouble is that "targetfolder" is just a string, not a folder.
(Sure, it has "folder" in its name, so you and I know it's supposed
to refer to a folder, but the Finder doesn't know that.) Adding the
word "folder" (or "item") makes it work as intended:
... name of files of folder targetfolder ...
However, this method of checking file existence can be slow, if there
are a large number of items in the folder (because Finder must build
& return a list of the names of all the items). Here's another way,
using "exists":
tell application "Finder"
if item myfilename of folder targetfolder exists then ...
end tell
Cheers,
--Dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden