Ruby 在 Windows 下播放声音
01
require?
"win32ole"
02
?03
sound =?
WIN32OLE
.
new
(
"MCI.MMcontrol"
)
04
?05
wav =?
"c:\\windows\\media\\The Microsoft Sound.wav"
06
sound.fileName = wav
07
?08
sound.autoEnable =?
true
09
?10
sound.command =?
"Open"
11
sound.command =?
"Play"
12
?13
sleep?
7