Jing, IIS, SWF, and Powershell fun
I've been using Jing to record short tutorial videos and uploading them to my IIS server's directory. To view or share them I would have to create a simple HTML file. I decided to automate this process by simply having the formatted HTML file generated when I threw a swf file into the directory using powershell.
# Here is the local directory on the IIS server where I'm throwing my swf files.
# This script is meant to run as a schedule task every 5 minutes or more if you like.
$VidPath = "D:\inetpub\wwwroot\videos"
# Here I'm querying for all the swf files in the directory.
$SWFFiles = get-childitem $VidPath | ? {$_.Extension -match ".swf"}
# This is where I begin to look @ each swf file and check whether they have an associated html file.
foreach ($SWFFile in $SWFFiles)
{
$HTMLCheck = $null
$HTMLCheck = Get-ChildItem $VidPath | where {$_.basename -eq $SWFFile.basename -and $_.Extension -ne $SWFFile.Extension}
# If I did not find an associated html file, this is where I would create one.
If ($HTMLCheck -eq $null)
{
$HTML = "<object width=`"100%`" height=`"100%`"> `
<param name=`"movie`" value=`"./$($SWFFile.name)`"> `
<embed src=`"./$($SWFFile.name)`" width=`"100%`" height=`"100%`">`
</embed> `
</object>"
$HTML | Out-File "$($VidPath)\$($SWFFile.Basename).html" -Encoding ASCII
}
}
I use this script in conjunction w/ my iPad directory script for fun.
# Here is the local directory on the IIS server where I'm throwing my swf files.
# This script is meant to run as a schedule task every 5 minutes or more if you like.
$VidPath = "D:\inetpub\wwwroot\videos"
# Here I'm querying for all the swf files in the directory.
$SWFFiles = get-childitem $VidPath | ? {$_.Extension -match ".swf"}
# This is where I begin to look @ each swf file and check whether they have an associated html file.
foreach ($SWFFile in $SWFFiles)
{
$HTMLCheck = $null
$HTMLCheck = Get-ChildItem $VidPath | where {$_.basename -eq $SWFFile.basename -and $_.Extension -ne $SWFFile.Extension}
# If I did not find an associated html file, this is where I would create one.
If ($HTMLCheck -eq $null)
{
$HTML = "<object width=`"100%`" height=`"100%`"> `
<param name=`"movie`" value=`"./$($SWFFile.name)`"> `
<embed src=`"./$($SWFFile.name)`" width=`"100%`" height=`"100%`">`
</embed> `
</object>"
$HTML | Out-File "$($VidPath)\$($SWFFile.Basename).html" -Encoding ASCII
}
}
I use this script in conjunction w/ my iPad directory script for fun.
Comments