• 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: drapplet?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>


 _______________________________________________
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

  • Follow-Ups:
    • Re: drapplet?
      • From: "S. J. Cunningham" <email@hidden>
References: 
 >drapplet? (From: Mitchell L Model <email@hidden>)
 >Re: drapplet? (From: "S. J. Cunningham" <email@hidden>)

  • Prev by Date: Re: I broke AppleScript
  • Next by Date: Re: drapplet?
  • Previous by thread: Re: drapplet?
  • Next by thread: Re: drapplet?
  • Index(es):
    • Date
    • Thread