• 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: Killall Finder Brings Hidden Apps To Front?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Killall Finder Brings Hidden Apps To Front?


  • Subject: Re: Killall Finder Brings Hidden Apps To Front?
  • From: has <email@hidden>
  • Date: Tue, 13 Jan 2009 23:30:19 +0000

Chunk 1978 wrote:

ok... so i've decided to use a simple apple script for this:

tell application "Finder"
	quit
	delay 0.25
	launch
end tell

or this (which i believe is the same thing)

tell application "Finder"
	quit
	delay 0.25
	activate application "Finder"
end tell

but i'd like to know about the delay.  without the delay... in this
script the delay works to save the finder's window state and then to
relaunch the finder.  should i be concerned about this delay on older,
slower computers?  should it be longer?


Quitting an application and relaunching it immediately afterwards is a bit problematic as the 'quit' event will return before the application has finished terminating, with the result that you're trying to start up an application that's in the process of shutting down. Sticking in a delay is crude at best, and potentially unreliable as the time a process takes to terminate might vary. You might try getting the process's PID then repeatedly polling the system to see if that PID still exists, and only proceed with the relaunch once it ceases to be. (If you're in 10.5+, AppleScript's application objects have an 'is running' property, although I don't know if they do this or something else). To be honest, I'm not really sure what's best.

HTH

has
--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Killall Finder Brings Hidden Apps To Front?
      • From: "Chunk 1978" <email@hidden>
  • Prev by Date: Re: supress calling objectValueForTableColumn
  • Next by Date: Re: Strange Webview Problem
  • Previous by thread: Re: Killall Finder Brings Hidden Apps To Front?
  • Next by thread: Re: Killall Finder Brings Hidden Apps To Front?
  • Index(es):
    • Date
    • Thread