'Sort Options are "src", "albumTitle", "albumArtist", "trackTitle", "trackArtist", "duration")
SortBy = "albumTitle"
Const ForWriting = 2
Const strDom = "Msxml2.FreeThreadedDOMDocument.3.0"
Const adTypeText = 2
Const adSaveCreateOverWrite = 2
Set BinaryStream = CreateObject("ADODB.Stream")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set xObj = CreateObject(strDom)
Set xObjSorted = CreateObject(strDom)
Set xslDoc= CreateObject(strDom)
For Each strArgument in Wscript.Arguments
	If xObj.Load(strArgument) Then
		bf = ""
		bf = bf & ""
		bf = bf & ""
		bf = bf & ""
		bf = bf & ""
		bf = bf & ""
		bf = bf & ""
		bf = bf & ""
		bf = bf & ""
		bf = bf & ""
		bf = bf & ""
		If xslDoc.LoadXML(bf) Then
			If xObjSorted.LoadXML(Replace(xObj.DocumentElement.SelectSingleNode("body").TransformNode(xslDoc),">"," />")) Then
        Set newChild = xObjSorted.DocumentElement.SelectSingleNode("seq")
				Set oldChild = xObj.DocumentElement.SelectSingleNode("body/seq")
        xObj.DocumentElement.SelectSingleNode("body").removeChild(oldChild)
        xObj.DocumentElement.SelectSingleNode("body").appendChild(newChild)
				BinaryStream.Type = adTypeText
				BinaryStream.Open
				BinaryStream.WriteText xObj.XML
				BinaryStream.SaveToFile strArgument, adSaveCreateOverWrite
		  	For Each metaNode in xObj.DocumentElement.SelectSingleNode("head").childNodes
					Select Case metaNode.getAttribute("name")
					Case "itemCount"
						numSongs = metaNode.getAttribute("content")
       		Case "totalDuration"
 						numMiliSecond = metaNode.getAttribute("content")
 						numMinutes = Cint((numMiliSecond / 1000) / 60)
 						numSeconds = Cint((numMiliSecond / 1000) mod 60)
						numHours = Cint(numMinutes / 60)
						numMinutes = Cint(numMinutes mod 60)
					End Select
				Next
				MsgBox    ("Playlist:  " & xObj.DocumentElement.SelectSingleNode("head").text _
		  	 & vbcrlf & "Length:  " & numHours & " hours, " & numMinutes & " Minutes, " & numSeconds & " seconds" _
				 & vbcrlf & "Tracks:  " & numSongs _
				 & vbcrlf & "Sorted By: " & SortBy )
				Set xObj = Nothing
				Set xObjSorted = Nothing
			Else
		    MsgBox "Error When Loading sorted " & xObjSorted.ParseError.reason
			End If
		Else
			MsgBox "Error When loading xsl " & xslDoc.ParseError.reason
		End If
	Else
	  MsgBox "Error When loading Playlist " & xObj.ParseError.reason
	End If
Next

    Source: geocities.com/soho/nook/3394

               ( geocities.com/soho/nook)                   ( geocities.com/soho)