From: calvin8@... (Andi Scharfstein) Date: 2003-06-16T00:15:43+09:00 Subject: Get songtitle from Winamp Hi, I just got the following to run, maybe someone finds it useful. All it does is extract the songtitle that Winamp is currently playing. Note that of course this only works in a Win32 environment. Also, the constant "4096" and "256" are just values that seemed to work for me. They might yet need correcting. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # Extract Songtitle from Winamp -- 2003 by Andi S. require "Win32API" findWindow = Win32API.new("user32", "FindWindow", ['P', 'P'], 'L') getWindowText = Win32API.new("user32", "GetWindowText", ['L', 'P', 'I'], 'I') hWnd = findWindow.call("Winamp v1.x", 0) if hWnd > 0 then song_array = " " * 256 getWindowText.call(hWnd, song_array, 4096) song_array.unpack('M')[0].strip! =~ /^\d+\. (.*) - Winamp.$/ song = $1 puts song else raise "Please start Winamp first!" end =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -- Bye: Andi S. mailto:nullpointer@myrealbox.com