• 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: How to start/restart the Finder from an AS app?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to start/restart the Finder from an AS app?


  • Subject: Re: How to start/restart the Finder from an AS app?
  • From: Chris Page <email@hidden>
  • Date: Mon, 21 Jan 2008 02:02:35 -0800

On Dec 21, 2007, at 00:45 AM, Philip Aker wrote:

tell application "System Events"
if (name of every application process does not contain "Finder") then

There's a race condition, because Finder could quit and restart before you test that it has quit, and then your script would repeat forever. Instead of testing by name, test by process id. Remember the current Finder's process id before quitting it, then check whether that specific process still exists:

tell application "System Events"
set Finder_ID to id of application process "Finder"
end tell

ignoring application responses
tell application "Finder" to quit
end ignoring

tell application "System Events"
repeat while exists application process id Finder_ID
delay 1
end repeat
end tell

tell application "Finder" to activate

-- 
Chris Page - AppleScripter

 The other, other AppleScript Chris



 _______________________________________________
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

  • Prev by Date: Re: Plist entry - Oops!
  • Next by Date: Find and Replace in Word 2008
  • Previous by thread: Re: INDESIGN: Object Style Preference Not Holding Between Launches
  • Next by thread: Find and Replace in Word 2008
  • Index(es):
    • Date
    • Thread