• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting the Folder name when using drag-&-drop Scripts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Re: Getting the Folder name when using drag-&-drop Scripts (From: "Easthope, John R" <email@hidden>)

  • Prev by Date: Re: Getting the Folder name when using drag-&-drop Scripts
  • Next by Date: Re: do visual basic
  • Previous by thread: Re: Getting the Folder name when using drag-&-drop Scripts
  • Next by thread: Reverse Offset (was Getting the Folder name when using drag-&-drop Scripts)
  • Index(es):
    • Date
    • Thread