' ActiveWinamp Script
' File: sendto_Nero Cover Designer.vbs
' Desc: sendto script to pass the current track selections
'       in Winamp to Nero Cover Designer
'
' v1.0 11/24/2004 6:01 PM maynardkrebs
'
 
'########################
' CODE
'########################
Const ForReading = 1, ForWriting = 2, ForAppending = 8
 
sel = GetSendToItems
 
If ubound(sel) = 0 Then
	MsgBox "There are no tracks selected in Winamp", _
		vbOKOnly+vbExclamation, "SendTo NCD"
	Quit
End If
 
Set wsh = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
scdc = wsh.ExpandEnvironmentStrings("%TEMP%") & "\watemp.cdc"
Set fcdc = fso.OpenTextFile(scdc, ForWriting, True)
Set dict = CreateObject("Scripting.Dictionary")
 
' Total Hack: abusing the dictionary object as a searchable
' data struct for tracking the number of unique artists/albums
' in the current selection and deriving the cd label artist and
' album fields. The logic goes something like this:
' If:Artists  Albums  Then:LabelArtist  LabelTitle
'    1        1            ArtistName    AlbumName
'    1        >1           ArtistName    Various
'    >1       X            Various       Various
'
tSel = 0
For Each track In sel
	key = track.Artist & Track.Album
	If Not dict.Exists(key) Then
		dict.Add key, track.Artist
	End If
	' Get the total selection time
	tSel = tSel + track.Length
Next
'Assume single artist/single album then verify
cdcArtist = "Artist=" & sel(1).Artist
cdcAlbum = "Title=" & sel(1).Album
bMultArtists = False
If dict.Count > 1 Then
	'multiple albums
	cdcAlbum = "Title=Various"
	artists = dict.Items
	dict.RemoveAll
	For Each artist In artists
		If Not dict.Exists(artist) Then
			dict.Add artist, ""
		End If
	Next
	If dict.Count > 1 Then
		' multiple artists
		bMultArtists = True
		cdcArtist = "Artist=Various"
	End If
End If
 
' Write NCD collection info
fcdc.WriteLine("[Parameters]")
fcdc.WriteLine("Language=English")
fcdc.WriteLine("[CDINFO]")
fcdc.WriteLine("Type=Audio-CD")
fcdc.WriteLine(cdcAlbum)
fcdc.WriteLine(cdcArtist)
fcdc.WriteLine("Tracks=" & ubound(sel))
fcdc.WriteLine("Playtime=" & tSel)
 
' Write NCD track info
i=1
For Each track In sel
	' Only include artist name if there are multiple artists
	If bMultArtists Then artist = track.Artist Else artist = ""
	fcdc.WriteLine("[Track" & i & "]")
	fcdc.WriteLine("Type=Audio")
	fcdc.WriteLine("Artist=" & artist)
	fcdc.WriteLine("Title=" & track.Title)
	fcdc.WriteLine(track.ATFString("Playtime=%lengthf%"))
	i=i+1
Next
 
fcdc.Close
 
' Launch Nero Cover Designer
On Error Resume Next
	ncdPath = wsh.RegRead("HKLM\SOFTWARE\Classes\Nero Cover " & _
		"Designer.Document\shell\open\command\\")
	ncdPath = Left(ncdPath, InStr(ncdPath, " /dde"))
	wsh.Exec(ncdPath & " " & scdc)
	If Err.Number Then
		MsgBox "There is a problem starting Nero Cover Designer", _
			vbOKOnly+vbExclamation, "SendTo NCD"
	End If
On Error GoTo 0
 
Quit
 
examples/application/nero_cover_designer_integration.txt · Last modified: 2006/11/06 15:44
 
Recent changes RSS feed Creative Commons License Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
Music Plugins