• 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: "S. J. Cunningham" <email@hidden>
  • Date: Wed, 25 Jan 2017 21:16:39 -0500

On Jan 25, 2017, at 9:08 PM, Shane Stanley wrote:

> 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.

Thanks, Shane.  I always learn something new from you as, I am sure, do the others on the list.

Steve
------------------
OS X 10.6.8, AppleScript 2.1.2


 _______________________________________________
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>)
 >Re: drapplet? (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: drapplet?
  • Next by Date: Re: An Acrobat Pro heads up.
  • Previous by thread: Re: drapplet?
  • Next by thread: An Acrobat Pro heads up.
  • Index(es):
    • Date
    • Thread