Re: Get path to a chosen folder
Re: Get path to a chosen folder
- Subject: Re: Get path to a chosen folder
- From: Mr Tea <email@hidden>
- Date: Tue, 26 Nov 2002 19:00:14 +0000
This from Kinsella, John R. - dated 26-11-02 3.57 pm:
>
Set folderOpen to choose folder with prompt "Choose your File."
>
Set mainFile to folderOpen & "theFile" as string
>
>
Now I need to be able to check and see if the file mainFile exists, but I
>
keep getting an error that it doesn't understand the exists message.
It seems a little perverse to use the prompt "Choose your File." in a choose
folder dialog, but leaving that aside, if you follow the lines of your
script with:
tell application "Finder"
exists file mainFile
end tell
...you should get a true or false result.
AFAIK, 'exists' is not a term that applescript understands, but it is part
of Finder's terminology.
An approach that doesn't use the Finder is to see if you get an error with
the line 'alias mainFile' but that's kinda kludgy and a lot less flexible.
A point to remember when using the Finder to check the existence of a file
like this is that it is 'hidden extension agnostic' - ie, it will return
true for a file that has a hidden name extension (eg, theFile.txt) whether
or not the name extension is given. In this case, the Finder won't
distinguish between 'theFile.txt', 'theFile.doc', 'theFile.jpg' etc. if an
extension is not specified.
Regards
Mr Tea
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.