Hi,
I hope this isn't seen as Off Topic, but I'm working on a pet project at
the moment, whose basic task is to populate my windows signature file with
the currently playing song from winamp. I do this already with random
quotes, which runs as a windows service (using Win32::Daemon) and writes to
the text file that is my signature file.
I have a working script to return the current song from winamp:
sub GetCurrentSong {
my $winampHandle = Win32::GUI::FindWindow("Winamp v1.x", "");
my $ret = "";
if ($winampHandle) {
print "$winampHandle";
## GRAB WINDOW TEXT ##
my $windowtext = Win32::GUI::Text( $winampHandle );
# trim "number. " from beginning
$windowtext =~ s/^\d+\. //i;
# trim " [paused] from end
$windowtext =~ s/ \[paused\]$//i;
# trim " [stopped] from end
$windowtext =~ s/ \[stopped\]$//i;
# trim " - winamp" from end
$windowtext =~ s/ - winamp$//i;
$ret = "$windowtext\n";
}
return $ret;
}
This runs fine on the command line, but not when I run it as part of a
service through Win32::Daemon. It fails to find a handle for winamp, even
though winamp is running. Is there something I'm not seeing that would
prevent a script running in the background as a service from finding a
current window handle in the foreground?
Thanks In Advance
Lee Hosty -x- MP3: Otep - Possesion (Demo)