in reply to Perl CD Player?
#!/usr/bin/perl -w # Modules use strict; use Win32::OLE; use Win32::OLE::Variant; # Variables use vars qw($Player $stop); # Initialize OLE Win32::OLE->Initialize(Win32::OLE::COINIT_MULTITHREADED); # Create a new OLE object $Player = Win32::OLE->new('MCI.MMControl.1') or die Win32::OLE->LastError(); # Set stuff $Player->{Notify} = Variant(VT_BOOL, 0); #off $Player->{Wait} = Variant(VT_BOOL, 1); #on $Player->{Shareable} = Variant(VT_BOOL, 0); #off $Player->{DeviceType} = "CDAudio"; # Open device $Player->{Command} = "Open"; # Skip first 3 songs print "Skipping songs...\n"; foreach (1..3) { $Player->{Command} = "Next"; } # Plays from 4th song... $Player->{Command} = "Play"; # ...until user presses enter print "Press enter to stop playback...\n"; $stop=<STDIN>; # Stop $Player->{Command} = "Stop"; # Close device $Player->{Command} = "Close"; print "Done.\n";
|
---|