Jump to content



Photo

Winamp Library [on pure AutoIt]


40 replies to this topic

#1 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,241 posts

Posted 14 May 2008 - 03:56 AM

Name/Title: Winamp Automation Library (Winamp 2.x +).

Description:
38 Functions to handle Winamp Media Player (http://winamp.com).
This library written base on the SDK that provided at Wanamp's home page: http://www.winamp.com/development/sdk

Version: 1.5
Requirements: AutoIt 3.2.10.0 or higher, Winamp 2.x or higher.
Note: This UDF Library tested on Winamp v5.x.

There is video available that shows how i started this UDF, the basic functions creation process :(
Watch the video and download the library here


New! Now compatible with AutoIt v3.3.0.0+.
=====================================================

Change Log:

v1.5 [16.12.2010]
* _Winamp_GetCurrentTrackInfo now returns an array as it should have:
0: Sample Rate in khz, 1: Bitrate, 2: Number of Channels, 3: Video LOWORD=w HIWORD=h, 4: Video Description, 5: Sample rate in hz
+ Added 4 new UDFs (thanks to Erion):
_Winamp_GetPan
_Winamp_SetPan
_Winamp_GetEq
_Winamp_SetEq

v1.4 [22.May.2009]
* The library now compatible with AutoIt v3.3.0.0.
* Added optional $h_Winamp_Wnd parameter to all functions that sends message to winamp's window - It should allow to manage multiple winamp instances.
(by default the handle is taken from $sWINAMP_CLASS).

v1.3 [19.May.2008]
The library now compatible with AutoIt v3.2.12.0.

Added UDF: _Winamp_ClearPlayList()
Added UDF: _Winamp_GetCurrentTrackFilePath()
Changed _Winamp_GetPlayListToArray() function.
Now it return a 2 dimensional array, where [0][0] is the element of current track, [n][0] is the track title, and [n][1] is the track file path.

* Fixed UDF _Winamp_GetCurrentTrackTitle(), with $iMode <> -1 it was not returning correct track position.

v1.2 [15.May.2008]
_Winamp_GetCurrentTrackOutputTime() function now always will return output time in milliseconds.
Now if $iMode = -1 (default) function return current position, if <> -1 it return song lenght.
Added UDF: _Winamp_GetVolume()

=====================================================

I know that lot of functions needs to be added, so please let me know what is missing, and i will try to add them :).

P.S
There is already available Winamp Automation Library by big_daddy, very good library, but that library required ActiveWinamp installation.

Edited by MrCreatoR, 06 March 2011 - 11:10 AM.

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team






#2 nobbe

nobbe

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 433 posts

Posted 14 May 2008 - 10:34 AM

REALY NICE!!

i added to the sample code

Local $iRandom_Song = Random(0, $iTotalSongs-1, 1)
_Winamp_Play($iRandom_Song)

;We wait untill the song starting to play...
While _Winamp_GetCurrentTrackPlayStatus() <> 1
Sleep(100)
WEnd

Sleep(100)

;; get current playtime in sec now.. -->
While _Winamp_GetCurrentTrackPlayStatus() = 1
ConsoleWrite(_Winamp_GetCurrentTrackOutputTime(0) / 1000 & @crlf)
Sleep(200)
WEnd


Local $iTrack_Lenght = _Winamp_GetCurrentTrackOutputTime(2)
_Winamp_Seek(Ceiling($iTrack_Lenght/2))
EndFunc

maybe the function _GetCurrentTrackOutputTime could be rewritten to get actual playing position in hrs:min:sec.fract as in media player ( i will do when i have time..)

#3 James

James

    jbrooksuk

  • MVPs
  • 9,470 posts

Posted 14 May 2008 - 10:38 AM

Very nice! I am so jealous of your skills!

#4 nobbe

nobbe

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 433 posts

Posted 14 May 2008 - 11:11 AM

ok i done it now - i added "GetCurrentTrackPlayPos"


;We wait untill the song starting to play...
While _Winamp_GetCurrentTrackPlayStatus() <> 1
Sleep(100)
WEnd

Sleep(100)

;; get current playtime in sec now..
While _Winamp_GetCurrentTrackPlayStatus() = 1
ConsoleWrite(_Winamp_GetCurrentTrackOutputTime(0) / 1000 & @crlf)

ConsoleWrite(_Winamp_GetCurrentTrackPlayPos() & @crlf)
Sleep(200)
WEnd

Local $iTrack_Lenght = _Winamp_GetCurrentTrackOutputTime(2)
;_Winamp_Seek(Ceiling($iTrack_Lenght/2))


AutoIt         
Func _Winamp_GetCurrentTrackPlayPos()     Local $hWinamp = WinGetHandle($sWINAMP_CLASS)     If Not IsHWnd($hWinamp) Then Return SetError(1, 0, -1)         Local $aRet         Local $l_std     Local $l_min     Local $l_sec     Local $t_str     Local $t_frac ; rest in millisec     $aRet = DllCall("user32.dll", "int", "SendMessage", _             "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", 0, "int", $IPC_GETOUTPUTTIME)     If @error Then Return SetError(3, 0, -1)     ;;$aRet[0] is in millisec     $t_in = $aRet[0];     $t_frac = Mod($t_in, 1000);     $t_in /= 1000; now in sec     $l_std = Int($t_in / 3600);     $l_min = Int(($t_in - ($l_std * 3600)) / 60) ;     $l_sec = Int(($t_in - ($l_std * 3600) - ($l_min * 60))) ;     $t_str = StringFormat("%02i:%02i:%02i.%03i", $l_std, $l_min, $l_sec, Int($t_frac))     ; _DebugPrint($t_str);         Return $t_str EndFunc   ;==>_Winamp_GetCurrentTrackPlayPos


#5 weaponx

weaponx

    I'm coming for blood, no code of conduct, no law.

  • MVPs
  • 5,366 posts

Posted 14 May 2008 - 01:46 PM

I see a cleaner version of my PlaylistToArray function in there, nice work. Thanks for the inclusion though, that script was a pain. :)

#6 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,241 posts

Posted 14 May 2008 - 11:47 PM

Thanks to all for the feedbacks!

@nobbe

ok i done it now - i added "GetCurrentTrackPlayPos"

Thanks, but actualy _Winamp_GetCurrentTrackOutputTime() can return the current position (with the default $iMode).
I think it's needs only one more parameter to return the position in specific time format:

AutoIt         
ConsoleWrite(_Winamp_GetCurrentTrackOutputTime(1, "hh:mm:ss:ms")) ;=============================================================================== ; ; Function Name:           _Winamp_GetCurrentTrackOutputTime() ; ; Function Description:    Gets current track time. ; ; Parameter(s):            $iMode - Defines what to return: ;                                       $iMode = 0 (default) returns current position in $sRet_Format format. ;                                       $iMode <> 0 returns the track length in $sRet_Format format. ;                          $sRet_Format - Defines what time format to return (ie. hh:mm:ss:ms). ; ; Requirement(s):          None. ; ; Return Value(s):         On Success -  Return output time for current track. ;                          On Failure -  Return -1 and set @error to: ;                                                                   1 - Unable to find Winamp window, probably winamp isn't runing. ;                                                                   2 - SendMessage fail. ; ; Author(s):               G.Sandler (a.k.a CreatoR) - CreatoR's Lab (http://creator-lab.ucoz.ru) ; ;===================================================================== Func _Winamp_GetCurrentTrackOutputTime($iMode = 0, $sRet_Format="ms")     Local $hWinamp = WinGetHandle($sWINAMP_CLASS)     If Not IsHWnd($hWinamp) Then Return SetError(1, 0, -1)         Local $aRet, $iRemainMS, $iHours, $iMinutes, $iSeconds, $iMSeconds         Switch $iMode         Case 0             $aRet = DllCall("user32.dll", "int", "SendMessage", _                     "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", 0, "int", $IPC_GETOUTPUTTIME)         Case Else             $aRet = DllCall("user32.dll", "int", "SendMessage", _                     "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", 1, "int", $IPC_GETOUTPUTTIME)     EndSwitch         If @error Then Return SetError(2, 0, -1)         $iMSeconds = $aRet[0]     If $iMode <> 0 Then $iMSeconds *= 1000         $iRemainMS = Mod($iMSeconds, 86400000)     $iHours = Int($iRemainMS / 3600000)     $iRemainMS = Mod($iMSeconds, 3600000)     $iMinutes = Int($iRemainMS / 60000)     $iRemainMS = Mod($iMSeconds, 60000)     $iSeconds = Int($iRemainMS / 1000)     $iRemainMS = Mod($iMSeconds, 1000)         If StringLen($iHours) = 1 Then $iHours = "0" & $iHours     If StringLen($iMinutes) = 1 Then $iMinutes = "0" & $iMinutes     If StringLen($iSeconds) = 1 Then $iSeconds = "0" & $iSeconds         $sRet = StringReplace($sRet_Format, "hh", $iHours, 1)     $sRet = StringReplace($sRet, "mm", $iMinutes, 1)     $sRet = StringReplace($sRet, "ss", $iSeconds, 1)     $sRet = StringReplace($sRet, "ms", Round($iRemainMS), 1)         Return $sRet EndFunc   ;==>_Winamp_GetCurrentTrackOutputTime

ALL
I need help to build one more function; _Winamp_GetVolume(). There is already _Winamp_SetVolume(), so it's fair enought that the library will include function to get the winamp's volume.
The SDK says this:

// these messages are callbacks that you can grab by subclassing the winamp window

// wParam =
....
....

#define IPC_CB_MISC_VOLUME 1 // volume/pan

So i guess that there is need to do some subclassing with these :(... but how? :)
Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#7 d2addict4

d2addict4

    Adventurer

  • Banned (NOT IN USE)
  • 107 posts

Posted 14 May 2008 - 11:50 PM

Wow. This is amazing.

#8 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,241 posts

Posted 14 May 2008 - 11:52 PM

I see a cleaner version of my PlaylistToArray function in there, nice work. Thanks for the inclusion though, that script was a pain. :(

Yes, this function helped me for few of mine's, thanks for that one! :)
Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#9 nobbe

nobbe

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 433 posts

Posted 15 May 2008 - 08:02 AM

good work with the time display

- is it possible to delete one or all entries in the playlist ? i would like to add only one file and play only one file - then delete this file from playlist - then play another file etc..

#10 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,241 posts

Posted 15 May 2008 - 08:03 AM

Update:

v1.2 [15.May.2008]
_Winamp_GetCurrentTrackOutputTime() function now always will return output time in milliseconds.
Now if $iMode = -1 (default) function return current position, if <> -1 it return song lenght.
Added UDF: _Winamp_GetVolume() (thanks to rasim that found a quit simple solution).
Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#11 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,241 posts

Posted 15 May 2008 - 08:12 AM

good work with the time display

I decided to return only milliseconds, i think the function should return the optimal value, so the user can do with it whatever he needs to.

is it possible to delete one or all entries in the playlist ?

I am not sure about one, but to clear the playlist use this:

Global Const $IPC_DELETE                = 101 ;Clear the PlayList _Winamp_ClearPlayList() Func _Winamp_ClearPlayList()     Local $hWinamp = WinGetHandle($sWINAMP_CLASS)     If Not IsHWnd($hWinamp) Then Return SetError(1, 0, 0)         DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", 0, "int", $IPC_DELETE)         If @error Then Return SetError(2, 0, 0)         Return 1 EndFunc

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#12 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,241 posts

Posted 15 May 2008 - 08:56 AM

@weaponx
Maybe you can help me with this one - i wanted to change the function _WinapGetPlayListToArray(), so it will return 2 dementional array, where [0] is the track title, and [1] is the track full file path.

Here is what i tried base on this thread:

Const $IPC_GETPLAYLISTFILEW = 215 Const $IPC_GETLISTPOS = 125 $hWinamp = WinGetHandle($sWINAMP_CLASS) $iWinamp_PID = WinGetProcess($hWinamp) $iCurrent_Track = DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", 0, "int", $IPC_GETLISTPOS) __API_GetInfoByAddress(0, 0) $pAddress = DllCall("user32.dll", "int", "SendMessage", _     "hwnd", $hWinamp, "int", $WM_WA_IPC, "int", $iCurrent_Track[0], "int", $IPC_GETPLAYLISTFILEW) $sFile_Path = __API_GetInfoByAddress($pAddress[0], $iWinamp_PID) ConsoleWrite($sFile_Path)


But it's return an empty string :)

If we use IPC_GETPLAYLISTFILEA (214), then it return only the first character. Any ideas?


OK, i think i found a solution - i only needed to use IPC_GETPLAYLISTFILEW = 211 instead of 215 :(

Edited by MrCreatoR, 15 May 2008 - 09:19 AM.

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#13 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,241 posts

Posted 19 May 2008 - 05:35 PM

Library Updated:

v1.3 [19.May.2008]
The library now compatible with AutoIt v3.2.12.0.

Added UDF: _Winamp_ClearPlayList()
Added UDF: _Winamp_GetCurrentTrackFilePath()
Changed _Winamp_GetPlayListToArray() function.
Now it return a 2 dimensional array, where [0][0] is the element of current track, [n][0] is the track title, and [n][1] is the track file path.

* Fixed UDF _Winamp_GetCurrentTrackTitle(), with $iMode <> -1 it was not returning correct track position.

See first post please.
Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#14 weaponx

weaponx

    I'm coming for blood, no code of conduct, no law.

  • MVPs
  • 5,366 posts

Posted 19 May 2008 - 06:34 PM

Just letting you know. I downloaded your latest zip file and I get these errors with Autoit 3.2.12.0:

C:\Documents and Settings\######\My Documents\Design\AutoIT\UDF\Winamp_Library\Winamp_Library.au3(713,84) : ERROR: Opt() called with illegal argument 1: "RunErrorsFatal"      If @AutoItVersion <= "3.2.10.0" Then Local $iOld_Opt_REF = Opt("RunErrorsFatal", 0)      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^  C:\Documents and Settings\######\My Documents\Design\AutoIT\UDF\Winamp_Library\Winamp_Library.au3(725,74) : ERROR: Opt() called with illegal argument 1: "RunErrorsFatal"      If @AutoItVersion <= "3.2.10.0" Then Opt("RunErrorsFatal", $iOld_Opt_REF)      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^  C:\Documents and Settings\######\My Documents\Design\AutoIT\UDF\Winamp_Library\Example.au3 - 2 error(s), 0 warning(s)


And how would that version comparison work? Maybe something like this would work better:
http://www.autoitscript.com/forum/index.ph...st&p=418119

Edited by weaponx, 19 May 2008 - 06:36 PM.


#15 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,241 posts

Posted 19 May 2008 - 07:00 PM

Just letting you know. I downloaded your latest zip file and I get these errors with Autoit 3.2.12.0:

C:\Documents and Settings\######\My Documents\Design\AutoIT\UDF\Winamp_Library\Winamp_Library.au3(713,84) : ERROR: Opt() called with illegal argument 1: "RunErrorsFatal"      If @AutoItVersion <= "3.2.10.0" Then Local $iOld_Opt_REF = Opt("RunErrorsFatal", 0)      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^  C:\Documents and Settings\######\My Documents\Design\AutoIT\UDF\Winamp_Library\Winamp_Library.au3(725,74) : ERROR: Opt() called with illegal argument 1: "RunErrorsFatal"      If @AutoItVersion <= "3.2.10.0" Then Opt("RunErrorsFatal", $iOld_Opt_REF)      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^  C:\Documents and Settings\######\My Documents\Design\AutoIT\UDF\Winamp_Library\Example.au3 - 2 error(s), 0 warning(s)


And how would that version comparison work? Maybe something like this would work better:
http://www.autoitscript.com/forum/index.ph...st&p=418119

Yes, on syntax check there will be errors, but this function works :( Ok, it maybe works, but not properly... fixed :) ...


Edited by MrCreatoR, 19 May 2008 - 07:10 PM.

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#16 weaponx

weaponx

    I'm coming for blood, no code of conduct, no law.

  • MVPs
  • 5,366 posts

Posted 19 May 2008 - 07:44 PM

I'm not trying to nitpick but you can't outright compare version numbers using standard operators, heres why.

Say you want to make sure the user has at least 3.2.10.0, in this format you have 32100.

Lets say I install future version 3.3.1.0, giving me 3310 with your code.

It will say my version is too low. Version numbers must be compared by octet and each octet must be padded so it aligns properly with its adjacent octet, ie...

3.3.01.0 = 33010
3.2.10.0 = 32100

This is what my script does in the link I provided.

#17 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,241 posts

Posted 19 May 2008 - 08:24 PM

I don't understand to be honest, if i strip all dots, and i use it as number, then it should be ok...

$Version_1 = Number(StringReplace("3.3.01.0", ".", "")) ; = 33010 $Version_2 = Number(StringReplace("3.2.10.0", ".", "")) ; = 32100 ;$Version_1 = Number(StringReplace("3.2.8.0", ".", "")) ;$Version_2 = Number(StringReplace("3.2.12.0", ".", "")) ConsoleWrite($Version_1 > $Version_2)


But later i will check your UDF more deeper, thanks.

Edited by MrCreatoR, 19 May 2008 - 08:25 PM.

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#18 weaponx

weaponx

    I'm coming for blood, no code of conduct, no law.

  • MVPs
  • 5,366 posts

Posted 19 May 2008 - 08:27 PM

@AutoItVersion would return 3.3.1.0, not 3.3.01.0, most likely.

#19 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,241 posts

Posted 19 May 2008 - 09:10 PM

@weaponx
Ok, you are persuaded me :( - The archive re-uploaded.

But i changed the UDF a little :) (only the variable's names).
Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#20 therks

therks

    Witty quote

  • Active Members
  • PipPipPipPipPipPip
  • 2,163 posts

Posted 19 May 2008 - 10:45 PM

I think perhaps it should be up to the user to supply the proper window handle to the functions. What if I have two Winamp windows open? How would I specify which window I want the functions to act on? Otherwise looks really good, it will be nice to have something that doesn't rely on ActiveWinamp.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users