Public feed
#723929
#!/usr/bin/perl -w
use Tk;
use Tk::Button;
use DirHandle;
use Win32::Sound;
use strict;
sub play($) { Win32::Sound::Play( $_[0] ); }
my $main = new MainWindow();
my $dh = new DirHandle( "." );
while( my $filename = $dh->read() )
{
next unless $filename =~ /[.]wav$/i;
my $buttonname = $filename;
$buttonname =~ s/[.]wav$//i;
my $button = $main->Button( -text => $buttonname,
-command => sub { play( $filename ); } );
$button->pack( -fill => "x", -padx => 2, -pady => 2 );
}
MainLoop;
its windows, but you get the idea ;)