• 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: Quit app and retarget
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quit app and retarget


  • Subject: Re: Quit app and retarget
  • From: has <email@hidden>
  • Date: Fri, 16 Apr 2010 23:10:45 +0100

Jonathan Mitchell wrote:

> The following script fails with Xcode got an error if Xcode is already running: Connection is invalid.
> Presumably this is because I quit xcode and then retarget.

As you say, it's a timing issue. 'quit' returns immediately, so the next command is being sent the process while it's still shutting down.

Safest solution is to wait until the process has terminated before proceeding, e.g.:

tell application "Finder"
	quit
	repeat while running
		delay 0.1
	end repeat
	home
end tell

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

 _______________________________________________
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: OSAScript class reference
  • Next by Date: Re: OSAScript class reference
  • Previous by thread: Fwd: Quit app and retarget
  • Next by thread: OSAScript class reference
  • Index(es):
    • Date
    • Thread