Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: App and droplet
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: App and droplet




On 11 Oct 2006, at 18:33, Craig Stanton wrote:

Is there a good way to make a script quit when it was started with drag-and-drop, but stay open if it was started by double clicking?

Sure, Craig - although you'd also need to consider a way to let the user quit when required (short of a force-quit). The following method, which should obviously be saved as a stay-open app, uses a second double-click (reopen) to give the user that option:


--------

property really_quit : true

on open some_list
	(* do something with some_list *)
	if really_quit then quit
end open

on reopen
	display dialog "Quit this application?"
	set really_quit to true
	quit
end reopen

on run
	set really_quit to false
end run

--------

Another way would be to place the conditional statement in a quit handler:

--------

property really_quit : true

on open some_list
	(* do something with some_list *)
	quit
end open

on reopen
	display dialog "Quit this application?"
	set really_quit to true
	quit
end reopen

on quit
	if really_quit then continue quit
end quit

on run
	set really_quit to false
end run

--------

---
kai


_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >App and droplet (From: Craig Stanton <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.