Choose File ... controlling the folder shown?
Choose File ... controlling the folder shown?
- Subject: Choose File ... controlling the folder shown?
- From: David Crowe <email@hidden>
- Date: Thu, 6 Feb 2003 10:47:41 -0700
When using "Choose file" (or Choose File Name or Choose Folder) is it
possible to control the starting folder for the dialog?
Also, is it possible to select multiple files?
Perhaps there is another osax that gives these capabilities?
I have come up with a workaround, that builds a list from the
contents of a folder and presents the filenames to the user as a
list. But, it doesn't strike me as the most elegant solution.
(*
* ChooseFilesToTransfer(theFolder) - Allows the user to select files
only within the specified folder
*
* Returns: List of references to chosen files (null list on failure)
*)
on ChooseFilesToTransfer(theFolder)
tell application "Finder"
set NameList to name of every item in theFolder --
Make a list from the files within the folder
try
set NameList to choose from list NameList
with prompt "Choose the list of files to transfer (CMD-click to
select more than one file)" with multiple selections allowed
on error
return {} -- On failure, return a null list
end try
if NameList = false then return {} -- Cancel returns
'false', rather than a null list (dumb, huh?)
set FileList to {} -- We have a list of names, let's
make it a list of files by building the full path name.
repeat with aName in NameList
set FileList to (FileList & (((theFolder as
string) & aName) as alias))
end repeat
return (FileList) -- The list of files chosen
end tell
end ChooseFilesToTransfer
- David Crowe
_______________________________________________
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.