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: Chris Espinosa <email@hidden>
- Date: Wed, 10 Mar 2004 16:06:29 -0800
On Mar 10, 2004, at 2:53 PM, Easthope, John R wrote:
These two examples do not catch the actual Folder dropped but rather a
file or the container of a file.
* File
copy (choose file) as string to thePath
copy text (((length of thePath) + 2) - ((offset of ":" in (reverse of
characters of thePath) as string))) thru (length of thePath) of
thePath to filename
*File Container
copy (choose file) as string to thePath
copy text 1 thru ((length of thePath) - ((offset of ":" in (reverse of
characters of thePath) as string)) + 1) of thePath to filePath
(The second "copy" command of these examples should be entered as one
line.)
I am sure the solution is a variation of one of these.
The default handler for a script is the Run handler. When an item is
dropped on an applet, it invokes the Open handler in that script, with
a direct parameter of the objects that were dropped.
on open theFileList
repeat with theFile in theFileList
doMyThing(theFile)
end repeat
end open
on run
doMyThing(choose file)
end run
to doMyThing(f)
copy f as string to thePath
copy text (((length of thePath) + 2) - ((offset of ":" in (reverse of
characters of thePath) as string))) thru (length of thePath) of thePath
to filename
end doMyThing
Chris
_______________________________________________
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.