Re: Waiting for script to exit
Re: Waiting for script to exit
- Subject: Re: Waiting for script to exit
- From: Christopher Nebel <email@hidden>
- Date: Sun, 22 May 2005 14:24:51 -0700
On May 21, 2005, at 5:59 PM, Christopher Brown wrote: I've been writing a small applescript to run a refactoring (simply done by running a shell command), and then reload the document in SubEthaEdit. However, the open command runs before the shell script has exited. Is there any way to force the commands to run in sequence?
set refacCommand2 to "echo \"" & refacCommand & " " & docPath & " " & refacArgs & "\" | " & refacPath & refacBinary & " >> /Library/Logs/HaRe.log" tell application "Terminal" to do shell script refacCommand2
tell application "SubEthaEdit" to open the first text document
Ordinarily, "do shell script" *does* wait until it's finished. One thing worth pointing out is that there's no need to 'tell application "Terminal"' to do it -- it's not tied to any particular application, so it's best to tell yourself. Beyond that, it's hard to say what's going on -- on the surface, it looks like should work as you desire. Now, it's possible for shell commands to "daemonize" themselves, and therefore appear to return before all their work is done. Since I can't see what the "refactor" command is, exactly, I can't say whether or not that's the case. Though it may not apply to your case, have a look at TN2065 < http://developer.apple.com/technotes/tn2002/tn2065.html>.
--Chris Nebel AppleScript and Automator Engineering
|
_______________________________________________
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