mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-25 05:26:47 +01:00
Improved the scripts
This commit is contained in:
parent
9c606fbdd7
commit
8e384b6d67
@ -13,6 +13,7 @@ if ($Filename -eq "" ) {
|
||||
}
|
||||
|
||||
try {
|
||||
write-progress "Reading playlist '$Filename' ..."
|
||||
$Lines = get-content $Filename
|
||||
|
||||
add-type -assemblyName presentationCore
|
||||
@ -21,8 +22,17 @@ try {
|
||||
for ([int]$i=0; $i -lt $Lines.Count; $i++) {
|
||||
$Line = $Lines[$i]
|
||||
if ($Line[0] -ne "#") {
|
||||
$MediaPlayer.open("$Line")
|
||||
write-output "Playing '$Line' ..."
|
||||
$FullPath = (get-childItem "$Line").fullname
|
||||
do {
|
||||
$MediaPlayer.open("$Line")
|
||||
$Duration = $MediaPlayer.NaturalDuration.TimeSpan.TotalMilliseconds
|
||||
} until ($Duration)
|
||||
$MediaPlayer.Volume = 1
|
||||
$MediaPlayer.play()
|
||||
start-sleep -milliseconds $Duration
|
||||
$MediaPlayer.stop()
|
||||
$MediaPlayer.close()
|
||||
}
|
||||
}
|
||||
exit 0
|
||||
|
@ -13,10 +13,20 @@ if ($Filename -eq "" ) {
|
||||
}
|
||||
|
||||
try {
|
||||
add-type -assemblyName presentationCore
|
||||
$MediaPlayer = new-object system.windows.media.mediaplayer
|
||||
$MediaPlayer.open("$Filename")
|
||||
add-type -assemblyName PresentationCore
|
||||
$MediaPlayer = new-object System.Windows.Media.MediaPlayer
|
||||
|
||||
$FullPath = (get-childItem $Filename).fullname
|
||||
do {
|
||||
$MediaPlayer.open($FullPath)
|
||||
$Duration = $MediaPlayer.NaturalDuration.TimeSpan.TotalMilliseconds
|
||||
} until ($Duration)
|
||||
write-progress "Playing $Filename ..."
|
||||
$MediaPlayer.Volume = 1
|
||||
$MediaPlayer.play()
|
||||
start-sleep -milliseconds $Duration
|
||||
$MediaPlayer.stop()
|
||||
$MediaPlayer.close()
|
||||
|
||||
exit 0
|
||||
} catch {
|
||||
|
Loading…
Reference in New Issue
Block a user