by fizzjob » Tue Mar 04, 2014 4:16 pm
So I figured I'd take a crack at hacking together a Tunein Radio script - everything
seems to be based on xml files (
http://opml.radiotime.com/), but I'm having a hard time parsing them.
Here's what I've got so far - all it does is create a node in Net Radio, but I can't figure out how to populate the subnodes. Parsing XML just seems to elude me.
Code: Select all
Dim objXMLDoc
Dim NodeList
Dim Node
Dim ChildNode
Dim NodeAttr
Sub OnStartup
Set Tree = SDB.MainTree
Set Node = Tree.CreateNode
Node.Caption = "Tunein Radio"
Node.IconIndex = 56
Node.UseScript = Script.ScriptPath
Node.OnFillChildren = "FillGenres"
Tree.AddNode Tree.Node_Radio, Node, 3 ' Insert after the node
Node.HasChildren = True
End Sub
Sub FillGenres
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load("http://opml.radiotime.com")
set Node = objXMLDoc.getElementsByTagName("outline")
if Node.length > 0 then
For each x in Node
Set NewNode = Tree.CreateNode
NewNode.Caption = x.getattribute("text")
NewNode.IconIndex = 0
Tree.AddNode Node, NewNode, 3
next
end if
End Sub
When I run this code with wscript, I get the "text" attributes, but I'm having a hard time getting it into MM.
Code: Select all
Dim objXMLDoc
Dim NodeList
Dim Node
Dim ChildNode
Dim NodeAttr
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load("http://opml.radiotime.com")
set Node = objXMLDoc.getElementsByTagName("outline")
if Node.length > 0 then
For each x in Node
ChildNode = x.getattribute("text")
WScript.echo ChildNode
next
end if
So I figured I'd take a crack at hacking together a Tunein Radio script - everything [i]seems[/i] to be based on xml files (http://opml.radiotime.com/), but I'm having a hard time parsing them.
Here's what I've got so far - all it does is create a node in Net Radio, but I can't figure out how to populate the subnodes. Parsing XML just seems to elude me.
[code]Dim objXMLDoc
Dim NodeList
Dim Node
Dim ChildNode
Dim NodeAttr
Sub OnStartup
Set Tree = SDB.MainTree
Set Node = Tree.CreateNode
Node.Caption = "Tunein Radio"
Node.IconIndex = 56
Node.UseScript = Script.ScriptPath
Node.OnFillChildren = "FillGenres"
Tree.AddNode Tree.Node_Radio, Node, 3 ' Insert after the node
Node.HasChildren = True
End Sub
Sub FillGenres
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load("http://opml.radiotime.com")
set Node = objXMLDoc.getElementsByTagName("outline")
if Node.length > 0 then
For each x in Node
Set NewNode = Tree.CreateNode
NewNode.Caption = x.getattribute("text")
NewNode.IconIndex = 0
Tree.AddNode Node, NewNode, 3
next
end if
End Sub[/code]
When I run this code with wscript, I get the "text" attributes, but I'm having a hard time getting it into MM.
[code]Dim objXMLDoc
Dim NodeList
Dim Node
Dim ChildNode
Dim NodeAttr
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load("http://opml.radiotime.com")
set Node = objXMLDoc.getElementsByTagName("outline")
if Node.length > 0 then
For each x in Node
ChildNode = x.getattribute("text")
WScript.echo ChildNode
next
end if[/code]