Google Answers Logo
View Question
 
Q: Automating Windows Media Player 10 ( No Answer,   6 Comments )
Question  
Subject: Automating Windows Media Player 10
Category: Computers > Programming
Asked by: trw-ga
List Price: $20.00
Posted: 28 Nov 2005 10:41 PST
Expires: 02 Feb 2006 18:52 PST
Question ID: 598585
I need the ability to play tunes (wma files) in Windows Media Player
10 with some silence between each tune.  Simply playing from a
playlist results in one tune immediately following another; I want a
couple of seconds between them at least.  So what I figure I need is a
batch file or script that will plow through a folder and individually
submit each wma file in it for playback in WMP10, with a 2 second
delay between each.

Request for Question Clarification by sublime1-ga on 28 Nov 2005 11:00 PST
trw...

If you're doing this in order to make a recording with the
proper intervals, the way I've done this in the past is to
create a silent recording with a 2 second duration, creating
copies and renaming it as many times as needed to intersperse
it with a unique name in between the songs on your playlist.
Then arrange your playlist accordingly and start recording.

Let me know what you think...

sublime1-ga

Clarification of Question by trw-ga on 28 Nov 2005 11:33 PST
Creating a pause file occurred to me, but the contents of the target
folder change so I would have to manually recreate a playlist with the
pause files between each tune.  This needs to be automatable.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Automating Windows Media Player 10
From: kasimirgabert-ga on 28 Nov 2005 20:18 PST
 
I built a script that should do (as far as I know) exactly what you want it to.

-- How to use it
  -You need to have Perl installed (if you are using Windows install ActivePerl)
  -Create a file called pause.wma inside of your folder, and make it
the length that you want the pause to be
  -Double click the pauselist.pl file
  -Open up the .asx file inside of Windows Media Player

-- Options
  -If you want the pause file to be called something other than
pause.wma, then inside of your command prompt you should sent the
argument with the name of the file, for example type "pauselist.pl
lengthpause.wav".

-- The script

***********************************
#!/usr/bin/perl

#Developed by Kasimir Gabert
#11/28/05

use warnings;
use strict;

my $pausefile = $ARGV[0];
if ($pausefile eq "")
{
        $pausefile = "pause.wma";
}
$| = 1;
open (my $asxfile, ">", "pauseplaylist.asx");

print $asxfile '<ASX version = "3.0">' . "\n";
print $asxfile '<!--A simple playlist with entries to be played in
sequence with pauses.-->' . "\n";
print $asxfile '    <Title>Paused Playlist</Title>' . "\n";
print "Creating Pause Playlist:\n";
my @files = glob("*");
foreach my $file (@files)
{
        unless ($file eq "pauselist.pl" || $file eq $pausefile ||
$file eq "pauseplaylist.asx")
        {
                print $asxfile '    <Entry>' . "\n";
                print $asxfile '        <Ref href = "' . $file . '" />' . "\n";
                print $asxfile '    </Entry>' . "\n";
                print $asxfile '    <Entry>' . "\n";
                print $asxfile '        <Ref href = "' . $pausefile .
'" />' . "\n";
                print $asxfile '    </Entry>' . "\n";
                print "#";
        }
}
print $asxfile "</ASX>";
close ($asxfile);

__END__
***********************************

That should work for you.  If you have any problems then just add
another comment and I will see what I can do.
Subject: Re: Automating Windows Media Player 10
From: trw-ga on 29 Nov 2005 10:28 PST
 
Very close!  I placed the script file in Windows\System32 folder.  It
produces the desired result but also generates an error message. I'll
paste it below.

C:\Documents and Settings\trw\Desktop\My Muzic>pauselist.pl
Use of uninitialized value in string eq at
C:\WINDOWS\system32\pauselist.pl line 10.
Creating Pause Playlist:
#####
Subject: Re: Automating Windows Media Player 10
From: kasimirgabert-ga on 29 Nov 2005 13:55 PST
 
Hello,
I have no idea why that problem is occuring on your computer.  It
appears that there is either a non string argument, or the test for an
argument is not working.

Tell me if this script produces the same effect without an error message:
**********
#!/usr/bin/perl

#Developed by Kasimir Gabert
#11/28/05

use warnings;
use strict;

my $pausefile = "pause.wma";

$| = 1;
open (my $asxfile, ">", "pauseplaylist.asx");

print $asxfile '<ASX version = "3.0">' . "\n";
print $asxfile '<!--A simple playlist with entries to be played in
sequence with pauses.-->' . "\n";
print $asxfile '    <Title>Paused Playlist</Title>' . "\n";
print "Creating Pause Playlist:\n";
my @files = glob("*");
foreach my $file (@files)
{
        unless ($file eq "pauselist.pl" || $file eq $pausefile ||
$file eq "pauseplaylist.asx")
        {
                print $asxfile '    <Entry>' . "\n";
                print $asxfile '        <Ref href = "' . $file . '" />' . "\n";
                print $asxfile '    </Entry>' . "\n";
                print $asxfile '    <Entry>' . "\n";
                print $asxfile '        <Ref href = "' . $pausefile .
'" />' . "\n";
                print $asxfile '    </Entry>' . "\n";
                print "#";
        }
}
print $asxfile "</ASX>";
close ($asxfile);

__END__
**********

I hope that this works,
Kasimir Gabert
Subject: Re: Automating Windows Media Player 10
From: trw-ga on 29 Nov 2005 15:52 PST
 
No errors with the new version. What did you change or eliminate?
Subject: Re: Automating Windows Media Player 10
From: kasimirgabert-ga on 29 Nov 2005 18:21 PST
 
I just eliminated the test for whether or not $ARGV[0] exists.  It was
working on my computer, but for some reason the if ($ARGV[0]) { ... }
was actually trying to access the location behind the NULL pointer for
@ARGV, and the "use warnings;" was showing the "warning".  I am not
sure why this was happening on your computer, but I am glad that this
is working for you now.
Subject: Re: Automating Windows Media Player 10
From: trw-ga on 29 Nov 2005 19:59 PST
 
Kasimir,

You deserve the payment. Please do whatever it is that turns your
comment into an answer.  I appreciate your help!

Tim

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy