On 14 Apr 2008, at 15:02, Takaaki Kato wrote:
I tried the code, as Hans writes in the comment, you need to quit the app not just close the window. It would be great if closing the window writes back to TM document.
Well, without AppleScript I guess it's a bit tricky to do it, but you can try the following:
... # wait for CSSEdit (it must be quitted) touch /tmp/tm_css.tmp while [ `ps -ax | grep 'CSSEdit.app' | wc -l` == "1" ] do sleep 0.5 [[ /tmp/tm.css -nt /tmp/tm_css.tmp ]] && break done
# write file back to TM if [ -f /tmp/tm.css ]; then cat /tmp/tm.css | sed "s/^/$HEAD/" rm /tmp/tm.css rm /tmp/tm_css.tmp else beep exit_discard fi ...
That means, IF you quit CSSEdit OR you save the document in CSSEdit, TM will get the current content. But this works only once. Once you have saved that file TM won't be notified about further changes. One could write an HTML output window command, where you define a JavaScript loop using TextMate.system() as a kind of a listener, but I do not know how stable and/or useful it will be.
Maybe to use AppleScript would be better. But, as I already mentioned, I do not have CSSEdit.
--Hans