On 28/10/2005, at 22.01, thomas Aylott wrote:
I also can't seem to make an osascript textmate command that doesn't totally freeze textMate.
It deadlocks because when TM is executing commands, it's not managing the AS event loop. This can generally be overcome by running the osascript commands asynchronously (eventually TM will handle most events when running commands).
how do I run osascripts asynchronously?
More precisely, run the osascript command asynchronously:
osascript -e 'tell app "TextMate" to insert "foo"' &>/dev/null &
The last & makes it run as a subprocess, and the &>/dev/null redirects stdout/err so that the parent process can exit w/o having to wait for the subprocess. Of course with this approach, it's not possible to get any result back or take further actions after TextMate has executed the command.