Edit: Well now it seems to just work. I have no idea what's going on lol.
Can someone tell me what's going on here?
tell application "Terminal"
do script "killall Finder"
tell application "Finder"
repeat while running
end repeat
end tell
close window 1
quit
end tell
tell application "Finder"
repeat while not running
end repeat
activate
end tell
Finder got an error: Application isn’t running." number -600
is what I get. If I comment out
repeat while not running
end repeat
I don't get the error, but if I leave that in and comment out
activate
Instead, I also don't get an error. So apparently they interact with each other to cause an error somehow. If I add a delay I can avoid the problem, but I wan't to know why what I have causes an error. I have OS X 10.9.4.
Best Answer
You're killing Finder from Terminal, then telling Finder to 'repeat while running'... you just killed it, it's not running. You're also not doing anything in the repeat while, just telling the script to spin its wheels at full revs. I really have no clue what you're trying to achieve from this.
If you just want to restart the Finder [Opt/right clicking it in the dock is one easy way] then try..