AutoHotkey Community

It is currently May 27th, 2012, 10:58 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: April 27th, 2004, 3:47 pm 
Offline

Joined: April 5th, 2004, 7:24 pm
Posts: 98
Location: Connecticut USA
Winamp 5 has a built-in hotkey that puts the mp3 filename (the playing mp3) in the clipboard.

This lets me hear and move, "junk" songs to a delete directory

Note that the "send ^c" is required for this to work. not sure why since ^+0 populates the clipboard.

Code:
^m::
   send, ^+0               ;winamp5 hotkey (place mp3 filename in clipb)
   sleep 100
   PostMessage, 0x111, 40048, , ,Winamp    ;skip to next song
   ;clipwait
   send ^c                           ;required command ?
   FileMove, %clipboard%, f:\aMp3\delete   ; move mp3 to delete dir
return
[/quote]


Report this post
Top
 Profile  
Reply with quote  
PostPosted: August 28th, 2004, 2:37 pm 
hello

newbie here but cld somebody tellme how do u use this script....i.e. whatd i do after i run it...u kno to execute the script so that it can delete the song as all this scrpt does is set in the taskbar

Quote:

Script lines most recently executed (oldest first). Press [F5] to refresh.
The seconds elapsed between a line and the one after it is in parens to the right (if not 0).
The bottommost line's elapsed time is the number of seconds since it executed.

001: Return (120.08)

Press [F5] to refresh.



and shows this on opening it up...

thnx
dg_210


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 31st, 2005, 1:18 pm 
Offline

Joined: January 31st, 2005, 1:04 pm
Posts: 2
Hi,

Modified this script to copy the currently playing song to a "favorites" directory..

Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copy the file playing in winamp to a directory
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
^m::
   ;winamp5 hotkey ^+0 (place mp3 filename in clipb)
   send, ^+0
   sleep 100
   ; copy mp3 to favorites dir
   FileCopy, %clipboard%, c:\music\_favorites   
return


The ^c that you had in your script doesn't seem to be needed.

Thanks for the idea!

/Martin


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 31st, 2005, 4:26 pm 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
Phantom lurker! :twisted: 8)

:lol:


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Thanks, here's mine
PostPosted: April 10th, 2006, 3:15 pm 
Took your script and modified it to work with hidden winamp with Global Hotkeys enabled as follows:
Playback: Next in play list - Ctrl + Alt + Page Down
Playback: Previous in play list - Ctrl + Alt + Page Up
General: Copy file path - Ctrl + Alt + F12

;Delete current song to folder
^Del::
Send, ^!{F12} ;winamp5 hotkey (place mp3 filename in clipb)
Sleep 100
Send ^!{PgDn}
FileMove, %clipboard%, D:\Media\Audio\!del ; move mp3 to delete dir
return

Hope this helps.
Thanks


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 14th, 2007, 7:37 pm 
Offline

Joined: January 14th, 2007, 7:32 pm
Posts: 36
I'm running Winamp 5.23 and I have not seen a hotkey copy the path of the file being played to clipboard for quite a while. I think this functionality is gone...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 14th, 2007, 7:46 pm 
@ to whom it may concern
I've dropped 2 WinAMP postings at the Utilities section (yesterday) which might be of interest.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 14th, 2007, 10:29 pm 
Offline

Joined: January 14th, 2007, 7:32 pm
Posts: 36
I thought it wouldn't hurt to post my code, so here goes.

This sets up a hotkey (Ctrl + Shift + d) to move playback to the next track, delete the one that was playing, and remove it from the playlist

Code:
^+d::
SendMessage, 0x400,0,120,,ahk_class Winamp v1.x ;Writes current playlist to <winampdir>\Winamp.m3u and returns the current track number as the variable ErrorLevel (with the first track being 0)
FileReadLine, CurrentSongLocation, %ProgramFiles%\Winamp\winamp.m3u,  ( ErrorLevel + 1) * 2 + 1 ;Reads the location of the currently playing song and adjusts the linenumber based on the format of the m3u
PostMessage, 0x111,40048,,,ahk_class Winamp v1.x ;Plays next song
FileRecycle, C:%CurrentSongLocation% ;Deletes previous song (C: needs to be appended because of the format of the m3u)
PostMessage, 0x111,40222,,,ahk_class Winamp PE ;Empties missing files from playlist
return


Things this simple script doesn't account for:
You already have Ctrl + Shift + d as a hotkey
Winamp isn't located in Program Files\Winamp\Winamp.exe
Your mp3 files that are on your playlist aren't on your C:\ drive
You have other tracks on your playlist that no longer exist but you don't want them removed (The script removes _all_ missing files from the playlist, not just the one it removes)
Your winamp writes the winamp.m3u file differently than mine does (?)

These are all things that might hinder the correct functioning of the script so look out for them. Sorry for doing a half-a$$ed job -- it appears there are other (better) scripts out there for the same purpose.

Enjoy


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 4th, 2007, 3:32 pm 
Offline

Joined: January 14th, 2007, 7:32 pm
Posts: 36
Added support for files on multiple drives. I'm using winamp version 5.35 just in case it stops working in future version.. it's an fyi

Code:
^+d::
  SendMessage, 0x400,0,120,,ahk_class Winamp v1.x ;Writes current playlist to <winampdir>\Winamp.m3u and returns the current track number as the variable ErrorLevel (with the first track being 0)
  FileReadLine, CurrentSongLocation, %ProgramFiles%\Winamp\winamp.m3u,  ( ErrorLevel + 1) * 2 + 1 ;Reads the location of the currently playing song and adjusts the linenumber based on the format of the m3u
  StringLeft, FirstLetter, CurrentSongLocation, 1
  PostMessage, 0x111,40048,,,ahk_class Winamp v1.x ;Plays next song
  if FirstLetter != "\" ;If the track is on drive C: the drive letter is omitted
  {
    FileRecycle, %CurrentSongLocation% ;Deletes previous song from other drive
  }
  else
  {
    FileRecycle, C:%CurrentSongLocation% ;Deletes previous song from C: drive
    return
  }
  PostMessage, 0x111,40222,,,ahk_class Winamp PE ;Empties missing files from playlist
  return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 16th, 2009, 9:38 pm 
Offline

Joined: January 14th, 2007, 7:32 pm
Posts: 36
This is a better, updated version that works with Winamp 5.5 now:

Code:
^+d::
  IfWinExist, iTunes
    Run, %A_ScriptDir%\iTunesDelete.au3
  Else
  {
  SendMessage, 0x400,0,120,,ahk_class Winamp v1.x ;Writes current playlist to <winampdir>\Winamp.m3u and returns the current track number as the variable ErrorLevel (with the first track being 0)
  FileReadLine, CurrentSongLocation, %ProgramFiles%\Winamp\winamp.m3u,  ( ErrorLevel  * 2 ) + 3 ;Reads the location of the currently playing song and adjusts the linenumber based on the format of the m3u
  StringLeft, FirstLetter, CurrentSongLocation, 1 ;Used to determine what drive the track is on
  PostMessage, 0x111,40048,,,ahk_class Winamp v1.x ;Plays next song
  IfEqual, FirstLetter, \ ;If the track is on drive C:, Winamp omits the drive letter in the m3u so we check to see if it is on the C: drive
  {
   FileRecycle, C:%CurrentSongLocation% ;Deletes song from C: drive
  }
  else
  {
   FileRecycle, %CurrentSongLocation% ;Deletes song from other drive
  }
  IfWinExist, ahk_class BaseWindow_RootWnd
   ControlSend, Winamp Playlist Editor, !{DEL} ;Empties missing files from playlist
  }
  return


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Much more..
PostPosted: February 23rd, 2009, 5:31 pm 
Offline

Joined: September 15th, 2006, 10:25 am
Posts: 567
This is built on the great work of giants.. i just put it together..

slight quirk: the remove missing file works only after such a long sleep :( and does not in windowshade mode.. any help appreciated, esp. from VxE

Code:
#del:: ;Delete currently playing track from disk (Winamp)
CurrentSongPath := GetWinampTrackInfo("path")
PostMessage, 0x111,40048,,,ahk_class Winamp v1.x ;Plays next song
FileRecycle, %CurrentSongPath% ;Recycle song
sleep 10000
IfWinExist, ahk_class BaseWindow_RootWnd
 ControlSend,Winamp Playlist Editor,!{DEL}  ;Remove missing files from playlist
return


GetWinampTrackInfo( Mode="Title", Track="Current" )
{ ; Function by [VxE]. Version 0.1
   Window = ahk_class Winamp v1.x
   Message = 211
   SendMessage, 0x400, 0, 125, , %Window%
   IfEqual, ErrorLevel, Fail, Return
   IfEqual, Track, Current, SetEnv, Track, %errorlevel%
   Else   EnvSub, Track, % Track > 0
   If InStr(Mode, "t") = 1
      message += 1
   SendMessage, 0x400, %Track%, %message%,, %Window%
   index := errorlevel
   winget, pid, PID, %Window%
   hProcess := DllCall("OpenProcess","Int",16,"Int",0,"UInt",pid)
   VarSetCapacity(MVALUE,1,0)
   Loop, 255 ; can be bigger if truly necessary
   {
      DllCall("ReadProcessMemory","UInt",hProcess
      ,"UInt",index+A_Index-1,"Str",MVALUE,"UInt",1,"UInt *",0)
      IfEqual, MValue,, Break ; null terminate string
      str .= MValue
   }
   DllCall("CloseHandle", "UInt", hProcess)
   return %str%
}

_________________
If i've seen further it is by standing on the shoulders of giants

my site | ~shajul | WYSIWYG BBCode Editor


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 20th, 2009, 2:09 am 
Offline

Joined: January 14th, 2007, 7:32 pm
Posts: 36
This problem has been plaguing me with my script too. I figured out that if winamp is active and the playlist has focus, then doing a PostMessage and sending !{DEL} works just fine but if it's not active then there's always trouble.
Here is the best solution I could find. As far as I've tested, it's works all of the time even if Winamp is minimized (v 5.551)

Code:
    IfWinExist, ahk_class BaseWindow_RootWnd
    {
      WinActivate, ahk_class BaseWindow_RootWnd
      ControlClick,,, Playlist Editor
      Send, {Alt Down}{DEL}{Alt Up}
    }


Here's another script I thought of that seems to work well. It requires you to enable Winamp's Global Hotkeys and create a new hotkey for Copy file path (unicode). I set mine up randomly as ^!+7. This will skip the steps of having to write the .m3u file to the disk and reading it, although it uses the clipboard so you'll want to put whatever was in the clipboard before back by temporarily storing it

Code:
^+d::
  ClipStore := ClipboardAll            ; Save the entire clipboard to a variable of your choice.
  Clipboard =
  Send, ^!+7                   ; Winamp Global Hotkey for "Copy file path (unicode)"
  ClipWait
  PostMessage, 0x111,40048,,,ahk_class Winamp v1.x    ; Plays next song
  FileRecycle, %Clipboard%

  IfWinExist, ahk_class BaseWindow_RootWnd
  {
    ControlSend, Winamp PE1, !{DEL}          ; Remove missing files from playlist
  }

  Clipboard := ClipStore               ; Restore the original clipboard. Note the use of Clipboard (not ClipboardAll).
  ClipStore =                  ; Free the memory in case the clipboard was very large.
  return


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 54 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