I tried the new script. One problem, if you turn off the network, and play song, script would make an empty biography file, because it does not provide the test network. And later when you turn on your network, the script will not overwrite that file.
I changed something and I was able to prevent this behavior, but I don't understand how it works, and whether it is well written, so can you update, thanks
This is my script:
Dim WshShell
Set WshShell = createobject("wscript.shell")
strURL = "www.google.com"
set png = WshShell.exec("ping -n 1 " & strURL)
do until png.status = 1
wscript.sleep 50
loop
strPing = lcase(png.stdout.readall)
Select Case True
Case InStr(strPing, "reply from") > 1
folder = "C:\Users\mire\Desktop\foobar2000 xch4\lyrics\biography"
On Error resume Next
With CreateObject("Scripting.FileSystemObject")
If Not .FileExists(folder & "\" & WScript.Arguments.Item(0) & ".txt") Then
Set xml = CreateObject("MSXML2.DOMDocument.6.0")
xml.async = false
xml.load("http://developer.echonest.com/api/v4/artist/biographies?api_key=PKDMY7Z0SGFBW" & UCase(Right("denial", 4)) & "&license=cc-by-sa&format=xml&name=" & Replace(WScript.Arguments.Item(0), "&", "%26"))
.OpenTextFile(folder & "\" & WScript.Arguments.Item(0) & ".txt", 2, 1).Write(Replace(Replace(xml.selectSingleNode("/response/biographies/biography/text[../site='last.fm']").text, ". ", "." & vbCrLf & vbCrLf), ". ", "." & vbCrLf & vbCrLf) & vbCrLf & vbCrLf & "WIKIPEDIA BIO:" & vbCrLf & vbCrLf & Replace(Replace(xml.selectSingleNode("/response/biographies/biography/text[../site='wikipedia']").text, ". ", "." & vbCrLf & vbCrLf), ". ", "." & vbCrLf & vbCrLf))
End If
WScript.Echo .OpenTextFile(folder & "\" & WScript.Arguments.Item(0) & ".txt").ReadAll
End With
End Select