Making my internal speaker beep

M

Matt Ramos

Hello. I'm trying to execute a beep on my computer with ruby as an
alert, but I can't seem to get it to work.

I've looked online and I have this.

require "Win32API"
def beep
o = Win32API.new("kernel32","Beep",%w(i i) , 'v')
o.call(2000,50)
end

It seems to be calling the API exactly how I need, but it won't execute
the beep. Any tips/ideas?

Thanks,
Matt
 
J

James Britt

Matt said:
Hello. I'm trying to execute a beep on my computer with ruby as an
alert, but I can't seem to get it to work.

This works for me on Win2k

def beep
puts "\C-G"
puts "\C-G"
sleep(1)
puts "\C-G"
puts "\C-G"
end
 
W

William James

Matt said:
Hello. I'm trying to execute a beep on my computer with ruby as an
alert, but I can't seem to get it to work.

I've looked online and I have this.

require "Win32API"
def beep
o = Win32API.new("kernel32","Beep",%w(i i) , 'v')
o.call(2000,50)
end

It seems to be calling the API exactly how I need, but it won't execute
the beep. Any tips/ideas?

Thanks,
Matt

print "\a"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,166
Messages
2,570,907
Members
47,448
Latest member
DeanaQ4445

Latest Threads

Top