Play a sound when another application outputs to console

applescriptconsole

I currently have a program that I can't get the source-code to so I'm trying to find another way to do what I need. I was thinking of having an applescript just constantly listening to console and then playing a sound when a certain message is played. The app has to load information and then it outputs to console when it finishes. Would applescript be a good way to go about this?

Thanks!

Best Answer

Try running a command like this in a Terminal window instead:

syslog -w|while read l;do [[ $l = *'message text'* ]]&&afplay /System/Library/Sounds/Blow.aiff;done

syslog -w is a shorter alternative to tail -f /var/log/system.log.