Re: Getting the Folder name when using drag-&-drop Scripts
Re: Getting the Folder name when using drag-&-drop Scripts
- Subject: Re: Getting the Folder name when using drag-&-drop Scripts
- From: Michelle Steiner <email@hidden>
- Date: Wed, 10 Mar 2004 17:07:38 -0700
On Mar 10, 2004, at 3:53 PM, Easthope, John R wrote:
Does anyone know the language to capture the name of a folder dropped
onto an Applescript so that it can be assigned to a variable?
on open {dropped_item}
-- the curly braces force on open to consider only the first item
dropped if more than one are dropped at the same time.
tell application "Finder"
if kind of dropped_item is "folder" then
set foo to ((name of (dropped_item as alias)) as text)
else
display dialog "the dropped item was not a folder."
end if
end tell
end open
Choose file has nothing to do with dropping a folder onto an
Applescript.
These two examples do not catch the actual Folder dropped but rather a
file or the container of a file.
The container of a file is the file's folder. If you want to get the
folder containing a file, try this:
set a to choose file
tell application "Finder"
set foo to the folder of a
end tell
foo
--
A great Idea! That's what we need--a great idea.
--Pesudolous, (A Funny Thing Happened on the way to the forum)
_______________________________________________
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.