Old 24th February 2014, 08:58   #1
ToyTank
Junior Member
 
Join Date: Feb 2014
Posts: 4
Queue Song From External Script

Here is a small script done in AutoIt to help you send a song to Winamp's queue using SendMessage routine.

I need that to use and old Smartphone as my bluetooth remote control. I am using an application no longer supported (PuppetMaster) and I need this script to reach my goal.

The playlist will not be usable while the script runs (very fast) with a mouse or keyboard, but when using a remote you are supposely away from the computer. The fact is that this is a "keyboard simulation" script.

Usage :
winampplq.au3 [SONG INDEX] or
winampplq.exe [SONG INDEX]


Have fun friends..! As I did doing it..
Attached Files
File Type: zip Winamp External Playlist Queue.zip (471.3 KB, 437 views)
ToyTank is offline   Reply With Quote
Old 24th February 2014, 09:00   #2
ToyTank
Junior Member
 
Join Date: Feb 2014
Posts: 4
AutoIt Script

#include <WinAPI.au3>
#include <SendMessage.au3>
#include <Misc.au3>

;This script was written by Daniel Godin in 2014
;Feel free to use it

;Usage is simple; Just past the playlist song index of the file to queue-"Q" as the commandline parameter
; EX : winamppl.au3 544
; would send to queue the song at index 544 of your actual playlist



If $CmdLine[0] = 0 Then Exit (1) ;check if a song index passed in command line

while _Singleton(@ScriptName, 1) = 0 ;check to run ONE instance of this script at a time
sleep(500) ;if already running, wait for his turn
wend



local $newpos=0 ;The index of the song in actual playlist you want to QUEUE-"Q"
local $plsize=0 ;Playlist Length
Local $hWnd = WinGetHandle("[CLASS:Winamp v1.x]") ;Find Winamp Window
Local $hWnd1 = WinGetHandle("[CLASS:Winamp PE]") ;Find Playlist Window
if $hwnd = 0 or $hwnd1 =0 Then
Exit (1) ;Nothing found .. exit!
endif



Local $plsize=_SendMessage($hwnd, 0x400, 0, 124) ;Get playlist length


HackWinampPL()

func HackWinampPL ()

if($cmdline[1]<$plsize and $cmdline[1] > 0) Then ;Make sure the index to queue is in the playlist range
$newpos=$cmdline[1]
Else
Exit (1)

EndIf

_SendMessage($hwnd1, 0x400, 105, _WinAPI_MakeLong ( $plsize-1, $newpos)) ;Switch the index to queue at the end of the playlist

;Shake the playlist to make sure the cursor is going on the last song (the one to queue)

_SendMessage($hwnd1,0x111, 0x19D49, 0) ;PAGEDOWN
_SendMessage($hwnd1,0x111, 0x19D62, 0) ;ARROW DOWN

_SendMessage($hwnd1,0x111, 0x1350, 0) ;QUEUE THE FILE BY SENDING "Q"

_SendMessage($hwnd1, 0x400, 105, _WinAPI_MakeLong ( $newpos, $plsize-1 )) ;Let's put back the queued song at its orignal place in the playlist (Switching)

;Shake the playlist to make sure the cursor is going away from the end of the playlist (else it can bug if another song is queued right after)

_SendMessage($hwnd1,0x111, 0x19D48, 0) ;PAGEUP
_SendMessage($hwnd1,0x111, 0x19D61, 0) ;ARROW UP

_SendMessage($hwnd1,0x111, 0x19DC9, 0) ;Finally a SPACEBAR to refresh playlist view on the actual playing song

EndFunc
ToyTank is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > Winamp Development

Tags
external plugin, playlist, queue, script, sendmessage

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump