1

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!

  • So you want to monitor Console and extract a message, that then plays a sound. Sending it back to Console might be tricky. – Ruskes Mar 1 '14 at 9:26
  • So this looks like a 3 part task. Part 1 is to monitor Console for a specific message. Part 2 is to generate a sound. Part 3 I am not clear what you want, what do you mean writing back in the console? – Ruskes Mar 1 '14 at 9:35
  • Hey Buscar. It was 1 Monitor Console 2 Play sound when console message appears. That's it! – ElRojito Mar 2 '14 at 3:39
2

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.

  • This is great! I had never heard of syslog. Would terminal be able to listen to an application log as well? – ElRojito Mar 2 '14 at 3:39
  • There is a potential problem. I used this great Terminal command with 'GoogleHelper' (that pesky POS)and now I have an orchestra playing :). just kidding :) – Ruskes Mar 2 '14 at 9:00
  • @ELRojito If the log messages are not included by syslog, try to use FSEventer to see if they are saved to some file. – Lri Mar 2 '14 at 17:07
0

Due to the fact that Console only shows Content of Log Files you should be able to do what you want by looking up the Logfiled exact location and than use something like this

tail -f <log-file> | grep "msg you are looking for" | beep

it's not a correct command but it points you in the right direction.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .