• 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: AppleScript or AppleEvent to emulate "Drag & Drop"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AppleScript or AppleEvent to emulate "Drag & Drop"


  • Subject: Re: AppleScript or AppleEvent to emulate "Drag & Drop"
  • From: bryan <email@hidden>
  • Date: Tue, 08 Jan 2002 03:46:09 -0500

There are two different meanings to emulation of drag and drop, in AS.

They are contextual.

In the first, to make the script perform as a drag and drop app (a "droplet")
you use the script structure:

on open (theFile) -- Or (listOfFiles)
someOperation (theFile)
end open

The second context is in sending a file (or folder or alias) to another application.
This is a Finder function and, although you may occasionally get the desired
response by using Jon's method below; without a 'tell application "Finder"'
wrapper I think it is likely to fail. I think Jon was implying the use in a Finder
wrapper in his post. (He's far too savvy a scripter not to.)

This has two possible contexts as well:
In the first, the File is merely intended to be opened by it's creator.
In this case a simple:

tell application "Finder"
open file "foo"
end tell

will suffice.

But in those situations were the file is to be opened by an application which was
NOT the creator; it is necessary to use the 'open ... using' construct:

tell application "Finder"
open file "foo" using alias "pathToApplication"
end tell

This non-intuitive construct is difficult to remember because you use 'file' in the
first case and 'alias' in the second. I'm not sure why this is so; it took me
about a half a dozen times, looking it up, to remember it.

Bryan Kaufman



Jon Pugh wrote:

> At 3:17 PM -0800 1/7/02, Charles Heizer wrote:
> >If I do a open statement in applescript it opens the app and tries to open the file, but it can't. If I drag and drop the file on the app it works.
>
> You might need to make a list of items, as the Finder always sends a list. That's what this sounds like to me.
>
> Instead of
>
> open file "foo"
>
> do
>
> open {file "foo"}
>
> Good luck.
>
> Jon
> _______________________________________________
> 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: 
 >AppleScript or AppleEvent to emulate "Drag & Drop" (From: Charles Heizer <email@hidden>)
 >Re: AppleScript or AppleEvent to emulate "Drag & Drop" (From: Jon Pugh <email@hidden>)

  • Prev by Date: Re: AppleScript and Email clients
  • Next by Date: Re: AppleScript Distribution Legalities
  • Previous by thread: Re: AppleScript or AppleEvent to emulate "Drag & Drop"
  • Next by thread: Array ??
  • Index(es):
    • Date
    • Thread