Re: drapplet?
Re: drapplet?
- Subject: Re: drapplet?
- From: Shane Stanley <email@hidden>
- Date: Thu, 26 Jan 2017 13:08:27 +1100
On 26 Jan 2017, at 12:31 pm, S. J. Cunningham <email@hidden> wrote:
Here is a template I use that allows you to use the same code whether it is dropped or run:
It's a bit unnecessarily complex to use a global and a property. And you're ignoring arguments to the run handler.
A simpler approach is this:
on open fileList my doMain(fileList, true) end open
on run runArg my doMain(runArg, false) end run
on doMain(someArg, isDroplet) if isDroplet then -- else -- end if end doMain
It has the extra merit of not having lots of top-level variables that get resaved on each run.
But if you want something bomb-proof, you need to hanled the case where someone drags-and-drops or double-clicks while the application is already running. That does need a global or property. |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
References: | |
| >drapplet? (From: Mitchell L Model <email@hidden>) |
| >Re: drapplet? (From: "S. J. Cunningham" <email@hidden>) |