Hello Powershell v.2

Get one record by 'random' from the XML file

You need the "text editeur" for Powershell to run this scripte. Ex. from Download the Powergui her!

cls

# Option 1
# Search and load the xml file on the D-Driver
# $Xliste = New-Object System.Xml.XmlDocument
# $Xliste.Load("C:\......Your folder name go's her......\JukeBox.xml")

# Option 2
# Search and load the xml file over the web
# Load the xml File als DownloadString
# On action now 
[xml]$XJukeBox = (New-Object System.Net.WebClient).DownloadString("http://www.geocities.ws/arenas/JukeBox/JukeBox.xml")

$XGeneral = $XJukeBox.selectNodes("/Audio/File/track[@type=""General""]")

# Header 1
write-host "`n'Test Attribute:'"

# Test Attribute
$XGeneral | ? { $_.CompleteName} | % { $_.type}| get-random

# Count files
write-host "`n'Count file to recording one:'"
write-host $XGeneral.count "files count to recording."

# Header 2
write-host "`n'Search by random the next FileRecordName to recording:'"
$XGeneral | % { "The FileRecordName and the Time to play: "+$_.CompleteName+" "+(new-timespan -start "00:00:00" -end $_.Duration_String)} | get-random

# Header 3
write-host "`n'End search'"

write-host "`n'That's all Folk.'"

# Clean variable
clear-variable X* -scope global -F

<#
You get:

'Test Attribute:'
General

'Count file to recording one:'
712 files count to recording.

'Search by random the next RecordName to recording:'
RecordName and Time to play: Niederoesterreich.mp3 00:01:35

'End search'

'That's all Folk.'
#>

You have any to resolving conflict ? Go her and instant messaging me.

png new.gif
© Arenas Mars. 2015