Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'A perl script to make things easier' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A perl script to make things easier
Authored by: Skurfer on May 12, '04 03:48:26PM
AppleScript? Pfft. If you want to do it the man's way, here's a perl script that will prompt for an artist and song name and save it in the current user's Movies directory.


use File::Copy;

print "Artist: ";
$artist = <STDIN>;
chomp( $artist );
print "Title: ";
$title = <STDIN>;
chomp( $title );
$filename = "${artist} - ${title}.mov";

$lsof_output = `lsof`;
@ofiles = split( "\n", $lsof_output );
foreach $file ( @ofiles ) {
  if ( $file =~ /^iTunes.* (\/.*QTPluginTemp.*)$/i ) {
    $temp_file = $1;
print "Source: $temp_file\n";
print "Copying ${filename} ...\n";
$username = `echo \${USER}`;
chomp( $username );
$out_file = "/Users/$username/Movies/$filename";
copy( $temp_file, $out_file ) or die "Copy failed: $!";

[ Reply to This | # ]