Input without blocking

You could always try RubyCocoa. From the main page (http://rubycocoa.sourceforge.net/doc/\):

The next script plays all the system sounds.

require 'osx/cocoa'
snd_files =`ls /System/Library/Sounds/*.aiff`.split
snd_files.each do |path|
   snd = OSX::NSSound.alloc.
     initWithContentsOfFile_byReference (path, true)
   snd.play
   sleep 0.5
end

Alpha Chen
0xCDE1AD58 on keyserver.net

···

On Mar 28, 2006, at 11:21 AM, Ernest Obusek wrote:

I wrote a little timer application and I would like it to play a sound when the timer has counted down to 0.

exec "osascript -e 'beep 1'"

Or, better yet, get ahold of osx/aeosa and use those bindings.

This is awesome! Thank you!

···

On Mar 28, 2006, at 11:52 AM, Alpha Chen wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mar 28, 2006, at 11:21 AM, Ernest Obusek wrote:

I wrote a little timer application and I would like it to play a sound when the timer has counted down to 0.

You could always try RubyCocoa. From the main page (http://rubycocoa.sourceforge.net/doc/\):

The next script plays all the system sounds.

require 'osx/cocoa'
snd_files =`ls /System/Library/Sounds/*.aiff`.split
snd_files.each do |path|
  snd = OSX::NSSound.alloc.
    initWithContentsOfFile_byReference (path, true)
  snd.play
  sleep 0.5
end

Alpha Chen
0xCDE1AD58 on keyserver.net

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFEKWnCTm5GrM3hrVgRAj3zAJ4tiRkOE4YgVoQQYP3f5opN7yjgmACgmpSK
dRXzk95XsgMd4kJvuoHq+WY=
=CMM9
-----END PGP SIGNATURE-----

Chris Alfeld wrote:

exec "osascript -e 'beep 1'"

Or, better yet, get ahold of osx/aeosa and use those bindings.

cin >> blocks. cin is basically the same thing as gets. I guess I will
just use a thread, but it seems kind of pointless to make the processor
have to schedule just for input.

···

--
Posted via http://www.ruby-forum.com/\.

I hope you never want to return after beeping

···

On Mar 28, 2006, at 11:55 AM, Chris Alfeld wrote:

exec "osascript -e 'beep 1'"

It isn't so much that I never want to return as that I want to become
one with the osascript and exit after beeping =)

My bad, meant 'system' not 'exec'; too much tcl in my past.

···

On 3/28/06, Logan Capaldo <logancapaldo@gmail.com> wrote:

On Mar 28, 2006, at 11:55 AM, Chris Alfeld wrote:

> exec "osascript -e 'beep 1'"

I hope you never want to return after beeping