Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Correct syntax for selectnode

Reply
 
Old 06-13-2008   #1 (permalink)
drunkeninja


 
 

Correct syntax for selectnode

I am trying to extract specific items from a MSINFO32.nfo file. I can
extract all the data I need except the drives and respective drive
sizes. I have decided to show the whole parent node /category of
Storage/Drives

What should be the correct syntax for this command?

sHardisks = oXML.SelectNode("Data[Item='Drives']/value").text

Error I get is Object does not support this property or method.

Many thanks in advance

My System SpecsSystem Spec
Old 06-15-2008   #2 (permalink)
drunkeninja


 
 

Re: Correct syntax for selectnode

On 14 Jun, 09:27, "Joe Fawcett" <joefawc...@xxxxxx> wrote:
Quote:

> "drunkeninja" <shaolindri...@xxxxxx> wrote in message
>
> news:9aa14afe-49da-445c-997a-be534d8c782d@xxxxxx> I am trying to extract specific items from a MSINFO32.nfo file. I can
Quote:

> > extract all the data I need except the drives and respective drive
> > sizes. I have decided to show the whole parent node /category of
> > Storage/Drives
>
Quote:

> > What should be the correct syntax for this command?
>
Quote:

> > sHardisks = oXML.SelectNode("Data[Item='Drives']/value").text
>
Quote:

> > Error I get is Object does not support this property or method.
>
Quote:

> > Many thanks in advance
>
> Can you show, or point to, an example of the XML?
>
> --
>
> Joe Fawcett (MVP - XML)http://joe.fawcett.name
Here is the code - using the method below I get size of drives but I
would like to show the whole category storage/drives ie drive letter
with drive size and free space etc.


sNFOFile = "C:\test\EuropeFP001.NFO"


Set oXML = CreateObject("MSXML2.DOMDocument")
oXML.async = False
oXML.load(sNFOFile)


sName= oXML.SelectSingleNode("//Data[Item='System Name']/Value").Text
sOS= oXML.SelectSingleNode("//Data[Item='OS Name']/Value").Text
sMemory = oXML.SelectSingleNode _
("//Data[Item='Total Physical Memory']/Value").Text


sCPU = EnumNode("CPU", 2, "//Data[Item='Processor']/Value", oXML)
sHardDisks = EnumNode("Hard Drive", 1, _
"//Category[@name='Disks']/Data[Item='Size']/Value", oXML)


MsgBox sCPU & vbCr & _
"Memory:" & vbTab & vbTab & sMemory & vbCr & sHardDisks


Function EnumNode(ByVal sTitle, ByVal iTabs, ByVal oNode, ByVal oXML)
Dim oCnt, oElem
Set oNode = oXML.SelectNodes(oNode)
iCnt = 0
For Each oElem in oNode
iCnt = iCnt + 1
EnumNode = EnumNode & sTitle & " #" & iCnt & ":" & _
String(iTabs, vbTab) & oElem.Text & vbCrLf
Next
EnumNode = Left(EnumNode, Len(EnumNode) - 2)
End Function
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Generic Interface syntax in VS 2005 using Old syntax .NET General
Help with syntax PowerShell
"invalid STORE command syntax invalid message set syntax" Vista mail
Help with Powershell syntax PowerShell
need syntax Vista hardware & devices


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46