AutoHotkey Community

It is currently May 26th, 2012, 7:10 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: May 16th, 2008, 1:16 pm 
Offline

Joined: November 19th, 2007, 4:59 pm
Posts: 144
Hi,

I need to get the Winamp Playlist position/index number
of the HIGHLIGHTED track. (as oppsosed to the Playing track)

The Winamp SDK shows no function for this, but this post
on the Winamp forum looks promising.

http://forums.winamp.com/showthread.php?postid=248474

(The Gamehack program can be downloaded here:)
http://personales.ya.com/mutante/download.html
***Caution: I think that installing this on W98 can
replace your MSVCRT.dll and MFC42.dll in C:\windows\system,
with older (5.0) versions. So backup those files to floppy before installing,
and copy them back from DOS after installing.
Hopefully some other memory scanner like Winspector could get
the the 3 memory locations mentioned in the above Winamp forums
post.

I need to use Winamp 2.80 but may use others later. This will be
very time consuming, so I would very much like to find a solution
for 2.80.

Note:
I want to avoid the [send, ^e] for the FileName. It just
looks bad. And I want to avoid the Loop, Read winamp.m3u
as it is unreliable with duplicate FileName's.

Thanks


Last edited by Visioneer on May 18th, 2008, 2:24 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 17th, 2008, 4:31 am 
Offline

Joined: October 1st, 2005, 9:55 pm
Posts: 774
Location: Texas, USA
Winamp v2.80 is pretty old. I did a quick internet search and found that it was released in early 2002. The good news is the Winamp SDK has been around for a very long time and many of functions are available for Winamp 2.x.

I'm using Winamp v5.x and I don't have access to any of the older 2.x versions to test this on but this should work for you. Give it a try/see:

Code:
;-- This is a two-step process.

;-- Step 1:  Get the hWnd Of the Playlist Editor
SendMessage
    ,0x400                  ;-- 0x400=WM_USER
    ,1                      ;-- 1=Playlist Editor
    ,260                    ;-- 260=GetWND
    ,,ahk_class Winamp v1.x

PE_hWnd:=ErrorLevel


;-- Step 2: Get the next selected.  Message sent to the Playlist Editor window.
SendMessage
    ,0x400                  ;-- 0x400=WM_USER
    ,112                    ;-- 112=GetNextSelected
    ,-1                     ;-- Start searching from here.  Set to -1 to start from the top.
    ,,% "ahk_id " . PE_hWnd

;-- Note: This message will return 4294967295 (AKA -1) if no Playlist items
;   were selected or if you're using a loop (i.e. not always starting from the
;   top), no more selected items were found.


PlaylistPos:=ErrorLevel
msgbox Playlist position (relative to 0) of 1st selected track: %PlaylistPos%


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 18th, 2008, 7:51 pm 
Offline

Joined: November 19th, 2007, 4:59 pm
Posts: 144
Thanks a lot jballi.

This works in Winamp 5.35 for me. However not in 2.80. I looked at
the older SDK and it ends at 111 (ugh). The new SDK has the 112 or
even the 3029. IPC_PLAYLIST_GET_NEXT_SELECTED 3029
SendMessage, 0x400, -1, 3029,, ahk_class Winamp v1.x vs. your
SendMessage, 0x400, 112, -1,, ahk_class Winamp PE

It will be a lot of rewriting for me to switch to 5+, but maybe I will
do that if no other solution comes to me.

Thanks Again


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 18th, 2008, 8:18 pm 
Offline

Joined: October 1st, 2005, 9:55 pm
Posts: 774
Location: Texas, USA
Visioneer wrote:
Thanks a lot jballi.

This works in Winamp 5.35 for me. However not in 2.80. I looked at
the older SDK and it ends at 111 (ugh). The new SDK has the 112 or
even the 3029. IPC_PLAYLIST_GET_NEXT_SELECTED 3029
SendMessage, 0x400, -1, 3029,, ahk_class Winamp v1.x vs. your
SendMessage, 0x400, 112, -1,, ahk_class Winamp PE.

Too bad.

I knew that IPC_PLAYLIST_GET_NEXT_SELECTED (3029) solution required Winamp 5.2+ so that's why I sent you the IPC_PE_GETNEXTSELECTED (112) solution for which I couldn't find a minimum Winamp version.

It might be time for you to come over to the dark side and upgrade to Winamp v5.5x. If you don't like the new version because it's too fat, you can always unload/uninstall many of the nice-to-have-but-not-needed plugins to speed things up. The new version also supports all of the classic skins.

Good luck!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 18th, 2008, 8:47 pm 
Offline

Joined: November 19th, 2007, 4:59 pm
Posts: 144
Thanks,

I tried to PM you but it keeps saying from me to me in Sent items.
Did you get it ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 19th, 2008, 6:15 pm 
Offline

Joined: October 1st, 2005, 9:55 pm
Posts: 774
Location: Texas, USA
Visioneer wrote:
Thanks,

I tried to PM you but it keeps saying from me to me in Sent items.
Did you get it ?

Yes, I got your message (2 copies) and I replied but I don't know if it worked or not. The message I sent is in my Outbox but not in my SentBox. I'm not a regular PM'er so I don't know what it means if a sent message is in one box but not in the other.

Whatever...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 21st, 2008, 4:27 pm 
Offline

Joined: November 19th, 2007, 4:59 pm
Posts: 144
Thanks for everything.

I did get your reply. A lot to think about. Very well written.

I had the same PM problem on my side. That's why I sent
it twice. I have PM'ed before several times and did not get
that. Normally it shows the proper send to, and in Sent as well
as Out box.

I think someone should tell Chris that the PM email is not working
properly.

Anyway, is there a bullet proof way to get the Winamp version consistantly
returned, from 1x to 5x+.

SendMessage, 0x400, 0, 0,, ahk_class Winamp v1.x
;0x0400 = WM_USER IPC_GETVERSION 0 Version will be 0x20yx for winamp 2.yx

It seems that the ErrorLevel to hex for 2.80 is 10240 > 0x2800, where as
for 5.24 it is 20516 > 0x5024 and for 5.35 it is 20533 >0x5035. The
format is different than the info states for 2x, 2.80 anyway.

I could hard wire something but I wanted to know if there is somthing
out there already that could return any version as for example "2.80"
and "5.24" etc etc. for any Winamp version.

Also, I would usually (ala javascript) try/check the function NOT the
version, but the ErrorLevel for your function above always returns 0,
(not FAIL) in 2.80, which would be like 5.24 returning the top line (0).
Is there a way to know if a SendMessage like this should be failing?


Thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 21st, 2008, 7:37 pm 
Offline

Joined: October 1st, 2005, 9:55 pm
Posts: 774
Location: Texas, USA
Visioneer wrote:
... is there a bullet proof way to get the Winamp version consistantly returned, from 1x to 5x+.

SendMessage, 0x400, 0, 0,, ahk_class Winamp v1.x
;0x0400 = WM_USER IPC_GETVERSION 0 Version will be 0x20yx for winamp 2.yx

It seems that the ErrorLevel to hex for 2.80 is 10240 > 0x2800, where as
for 5.24 it is 20516 > 0x5024 and for 5.35 it is 20533 >0x5035. The
format is different than the info states for 2x, 2.80 anyway.

Bulletproof? No, but there is method to the madness. From the SDK:

Winamp SDK wrote:
The version returned will be 0x20yx for Winamp 2.yx. Versions previous to Winamp 2.0 typically (but not always) use 0x1zyx for 1.zx. Just a bit weird but that's the way it goes.

For Winamp 5.x it uses the format 0x50yx for Winamp 5.yx
e.g. 5.01 -> 0x5001, 5.09 -> 0x5009, 5.1 -> 0x5010

Notes: For 5.02 this api will return the same value as for a 5.01 build. For 5.07 this api will return the same value as for a 5.06 build.

...so it will take a bit of "If the first hex digit is '2' then convert the return value using this method..." else "If the first hex digit is '5' then convert the return value using this method..." coding.

With version 5.x+, you can use the IPC_GETVERSIONSTRING message to get a consistent and accurate version but that won't help you in your current situation.


Visioneer wrote:
Also, I would usually (ala javascript) try/check the function NOT the version, but the ErrorLevel for your function above always returns 0, (not FAIL) in 2.80, which would be like 5.24 returning the top line (0). Is there a way to know if a SendMessage like this should be failing?

The short answer: I don't know.

Coding for unknown messages can be tricky. Sending an unknown message to some applications, Windows Media Player for example, can cause the application to crash.

I suspect that the Winamp developers created a catch-all routine for unknown messages so that it would respond quickly to all messages, valid or invalid. Unfortunately, the side effect of this methodology would be a 0 return code.

It's important to note that the return code of 'FAIL' is AutoHotkey generated value that doesn't necessarily mean that the message didn't work (although it usually does), it just means that the application did not respond within the 5-second timeout period.

I hope this helps.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher, kkkddd1 and 65 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group