My personal script:
http://2011sg.poshcode.org/1714
Average Rating: 5.00 by 2 users.
(Download it)
#
#
# 2011 Scripting Games Advanced Event 8: Use PowerShell to Remove Metadata and Resize Images
#
# by F.Richard 2011-04
#
#
# Windows form Generated By: SAPIEN Technologies, Inc., PrimalForms 2009
#
#Requires -Version 2.0
# Gloval variables for preferences
$global:ImageFolder = ""
$global:SaveFolder =""
#----------------------------------------------
function Select-Directory() {
param(
[string] $folder = ""
)
# Solution 1 : System.Windows.Forms.FolderBrowserDialog
# but requires STA (Single Threaded Apartment) mode to function correctly (that means -sta switch)
# or
# Solution 2 : COM object
# http://stackoverflow.com/questions/216817/call-folderbrowserdialog-from-powershell#217527
#
$app = New-Object -COM Shell.Application
$directory = $app.BrowseForFolder( 0, "Select Directory", 0 ) # , $folder
$path = $directory.Self.Path
if( $path ) { return $path }
}
function Set-FilesToListbox() {
param(
[string] $folder = (Split-Path -parent $MyInvocation.MyCommand.Path)
)
$listboxFile.Items.Clear()
# only files # where{!($_.PSISContainer)})
ForEach ($File in Get-ChildItem "$folder\*" -include *.bmp, *.tif, *.tiff, *.gif, *.jpg, *.jpeg, *.png ) {
$listboxFile.Items.Add($File.Name) | Out-Null
}
}
function Get-XMLpreferences() {
$defaultfolder = (Get-Location).Path
if (Test-Path($defaultfolder + "\" + "preferences.xml")) {
$xml = New-Object XML
$xml.Load($defaultfolder + "\" + "preferences.xml")
$lbImageFolder.Text = $xml.Preferences.ImageFolder
Set-FilesToListbox -folder $xml.Preferences.ImageFolder
$lbSaveFolder.Text = $xml.preferences.SaveFolder
} else {
$lbImageFolder.Text = $defaultfolder
Set-FilesToListbox -folder $defaultfolder
$lbSaveFolder.Text = $defaultfolder
}
$global:ImageFolder = $lbImageFolder.Text
$global:SaveFolder = $lbSaveFolder.Text
}
function Set-XMLpreferences() {
$defaultfolder = (Get-Location).Path
$xml = New-Object XML
$xmlroot = $xml.CreateElement("Preferences")
$xml.AppendChild($xmlroot) | Out-Null
$imagefolder = $xml.CreateElement("ImageFolder")
$ImageFolder.PSBase.InnerText = $global:ImageFolder
$xmlroot.AppendChild($ImageFolder) | Out-Null
$savefolder = $xml.CreateElement("SaveFolder")
$savefolder.PSBase.InnerText = $global:Savefolder
$xmlroot.AppendChild($savefolder) | Out-Null
$xml.Save($defaultfolder + "\" + "preferences.xml")
}
function Resize-Image() {
param(
[Array] $files
)
foreach ($file in $files) {
$imagefile = $lbImageFolder.Text + "\" + $file
$OldBitmap = [System.Drawing.Image]::FromFile($imagefile)
$width = [int]($OldBitmap.Width * (1/2))
$height = [int]($OldBitmap.Height * (1/2))
$NewBitmap = New-Object System.Drawing.Bitmap($width,$height)
$graphic=[System.Drawing.Graphics]::FromImage($NewBitmap)
$graphic.InterpolationMode = [System.Drawing.Drawing2D.InterpolationMode]::HighQualityBicubic
$graphic.DrawImage($OldBitmap, 0, 0, $width, $height) # resize
$savefile = $lbSaveFolder.Text + "\SHARE_" + $file
if (Test-Path($savefile)) {
Remove-Item ($savefile)
}
$NewBitmap.Save($savefile, ([System.Drawing.Imaging.ImageFormat]::jpeg))
$NewBitmap.Dispose()
$OldBitmap.Dispose()
}
[System.Windows.Forms.MessageBox]::Show("Resize Done","Resize")
}
function Resize-ImageKeepMetadata() {
# with this function we keep metada
param(
[Array] $files
)
foreach ($file in $files) {
$image = New-Object -ComObject Wia.ImageFile
$image.LoadFile($file)
$width = $image.Width * (1/2)
$height = $image.Height * (1/2)
$filter = New-Object -ComObject Wia.ImageProcess
$scale = $filter.FilterInfos.Item("Scale").FilterId
$filter.Filters.Add($scale)
$filter.Filters.Item(1).Properties.Item("PreserveAspectRatio") = $True
$filter.Filters.Item(1).Properties.Item("MaximumWidth") = $width
$filter.Filters.Item(1).Properties.Item("MaximumHeight") = $height
$image = $filter.Apply($image.PSObject.BaseObject)
$savefile = $lbSaveFolder.Text + "\SHARE_" + $file
if (Test-Path($savefile)) {
Remove-Item ($savefile)
}
# $image.SaveFile($savefile)
$image = $null
$filter = $null
}
[System.Windows.Forms.MessageBox]::Show("Resize Done","Resize")
}
#----------------------------------------------
#region Application Functions
#----------------------------------------------
function OnApplicationLoad {
#Note: This function runs before the form is created
#Note: To get the script directory in the Packager use: Split-Path $hostinvocation.MyCommand.path
#Note: To get the console output in the Packager (Windows Mode) use: $ConsoleOutput (Type: System.Collections.ArrayList)
#Important: Form controls cannot be accessed in this function
#TODO: Add snapins and custom code to validate the application load
return $true #return true for success or false for failure
}
function OnApplicationExit {
#Note: This function runs after the form is closed
#TODO: Add custom code to clean up and unload snapins when the application exits
# Save program preferences
Set-XMLpreferences
$script:ExitCode = 0 #Set the exit code for the Packager
}
#endregion
#----------------------------------------------
# Generated Form Function
#----------------------------------------------
function GenerateForm {
#----------------------------------------------
#region Import Assemblies
#----------------------------------------------
[void][reflection.assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[void][reflection.assembly]::Load("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
[void][reflection.assembly]::Load("mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[void][reflection.assembly]::Load("System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[void][reflection.assembly]::Load("System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
#endregion
#----------------------------------------------
#region Generated Form Objects
#----------------------------------------------
[System.Windows.Forms.Application]::EnableVisualStyles()
$formMain = New-Object System.Windows.Forms.Form
$btPrepareToShareAll = New-Object System.Windows.Forms.Button
$rtbMetadata = New-Object System.Windows.Forms.RichTextBox
$listboxFile = New-Object System.Windows.Forms.ListBox
$btPrepareToShare = New-Object System.Windows.Forms.Button
$lbSaveFolder = New-Object System.Windows.Forms.Label
$btSaveFolder = New-Object System.Windows.Forms.Button
$pictbox = New-Object System.Windows.Forms.PictureBox
$lbImageFolder = New-Object System.Windows.Forms.Label
$btImageFolder = New-Object System.Windows.Forms.Button
$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
#endregion Generated Form Objects
#----------------------------------------------
# User Generated Script
#----------------------------------------------
$FormEvent_Load={
# Load program preferences
Get-XMLpreferences
}
$handler_btImageFolder_Click={
$oldFolder = $lbImageFolder.Text
$newFolder = Select-Directory -folder $oldFolder
if ($newFolder) {
$lbImageFolder.Text = $newFolder
Set-FilesToListbox -folder $newFolder
}
$global:ImageFolder = $newFolder
}
$handler_btSaveFolder_Click={
$oldFolder = $lbSaveFolder.Text
$newFolder = Select-Directory -folder $oldFolder
if ($newFolder) {
$lbSaveFolder.Text = $newFolder
}
$global:SaveFolder = $newFolder
}
$handler_listboxFile_SelectedIndexChanged={
#TODO: Place custom script here
$file = $lbImageFolder.Text + "\" + $listboxFile.Text
$pictbox.Image = [System.Drawing.Image]::Fromfile($file)
$image = New-Object -ComObject Wia.ImageFile
$image.LoadFile($file)
# use EXIF quick reference
# http://nicholasarmstrong.com/2010/02/exif-quick-reference/
# and Display Detailed Image Information / Shared Samples
# http://msdn.microsoft.com/en-us/library/ms630826%28v=vs.85%29.aspx
$content = ""
$content += "Height: " + $image.Height + "`n"
$content += "Width: " + $image.Width + "`n"
$content += "Depth: " + $image.PixelDepth + "`n"
$content += "HorizontalResolution : " + $image.HorizontalResolution + "`n"
$content += "VerticalResolution : " + $image.VerticalResolution + "`n"
$content += "FrameCount : " + $image.FrameCount + "`n"
if ($image.IsIndexedPixelFormat) { $content += "Pixel data contains palette indexes" + "`n" }
if ($image.IsAlphaPixelFormat) { $content += "Pixel data has alpha information" + "`n" }
if ($image.IsExtendedPixelFormat) { $content += "Pixel data has extended color information (16 bit/channel)" + "`n" }
if ($image.IsAnimated) { $content += "Image is animated" + "`n" }
if ($image.Properties.Exists("271")) { $content += "Equipment Maker:" + $image.Properties.Item("271").Value + "`n" }
if ($image.Properties.Exists("272")) { $content += "Equipment Model:" + $image.Properties.Item("272").Value + "`n" }
$orientation = @{ 1 = "Horizontal"; 3 = "Rotate 180 degrees"; 6 = "Rotate 90 degrees clockwise" ; 8 = "Rotate 270 degrees clockwise" }
if ($image.Properties.Exists("274")) { $content += "Orientation:" + $orientation[[int]$image.Properties.Item("274").Value] + "`n" }
if ($image.Properties.Exists("282")) { $content += "X Resolution:" + $image.Properties.Item("282").Value.Value + "`n" }
if ($image.Properties.Exists("283")) { $content += "Y Resolution:" + $image.Properties.Item("283").Value.Value + "`n" }
$unit = @{ 1 = "None"; 2 = "Inches"; 3 = "Centimetres" }
if ($image.Properties.Exists("296")) { $content += "Resolution Unit:" + $unit[[int]$image.Properties.Item("296").Value] + "`n" }
if ($image.Properties.Exists("306")) { $content += "Modified Date Time:" + $image.Properties.Item("306").Value + "`n" }
if ($image.Properties.Exists("33434")) { $content += "Exposure Time:" + $image.Properties.Item("33434").Value.Value + "`n" }
if ($image.Properties.Exists("33437")) { $content += "F Number:" + $image.Properties.Item("33437").Value.Value + "`n" }
if ($image.Properties.Exists("34855")) { $content += "ISO Speed:" + $image.Properties.Item("34855").Value + "`n" }
if ($image.Properties.Exists("36867")) { $content += "Date Taken:" + $image.Properties.Item("36867").Value + "`n" }
if ($image.Properties.Exists("36868")) { $content += "Date Created:" + $image.Properties.Item("36868").Value + "`n" }
if ($image.Properties.Exists("37377")) { $content += "Shutter Speed:" + $image.Properties.Item("37377").Value.Value + "`n" }
if ($image.Properties.Exists("37378")) { $content += "Aperture:" + $image.Properties.Item("37378").Value.Value + "`n" }
if ($image.Properties.Exists("37380")) { $content += "Exposure Compensation:" + $image.Properties.Item("37380").Value.Value + "`n" }
if ($image.Properties.Exists("37381")) { $content += "Maximum Aperature:" + $image.Properties.Item("37381").Value.Value + "`n" }
$metering = @{ 0 = "Unknown"; 1 = "Average"; 2 = "Center-weighted average" ; 3 = "Spot"; 4 = "Multi-spot"; 5 = "Multi-segment"; 6 = "Partial"; 255 = "Unknown" }
if ($image.Properties.Exists("37383")) { $content += "Metering Mode:" + $metering[[int]$image.Properties.Item("37383").Value] + "`n" }
$flash = @{ 0 = "No Flash"; 10 = "Flash off"; 1 = "Flash on"; 11 = "Flash auto" }
if ($image.Properties.Exists("37385")) { $content += "Flash:" +$image.Properties.Item("37385").Value + "`n" }
if ($image.Properties.Exists("37386")) { $content += "Equipment Maker Note:" + $image.Properties.Item("37386").Value.Value + "`n" }
if ($image.Properties.Exists("37510")) { $content += "User Comment:" + $image.Properties.Item("37510").Value.Value + "`n" }
if ($image.Properties.Exists("40961")) { $content += "Color Space:" + $image.Properties.Item("40961").Value + "`n" }
if ($image.Properties.Exists("40962")) { $content += "Pixel X Dimension:" + $image.Properties.Item("40962").Value + "`n" }
if ($image.Properties.Exists("40963")) { $content += "Pixel Y Dimension:" + $image.Properties.Item("40963").Value + "`n" }
if ($image.Properties.Exists("41486")) { $content += "Focal Plane X Resolution:" + $image.Properties.Item("41486").Value + "`n" }
if ($image.Properties.Exists("41487")) { $content += "Focal Plane Y Resolution:" + $image.Properties.Item("41487").Value + "`n" }
$focal = @{ 1 = "None"; 2 = "Inches"; 3 = "Centimetres" ; 4 = "Millimetres"; 5 = "Micrometres" }
if ($image.Properties.Exists("41488")) { $content += "Focal Plane Resolution Unit:" + $focal[[int]$image.Properties.Item("41488").Value] + "`n" }
$sensing = @{ 1 = "Not defined"; 2 = "One-chip colour area"; 3 = "Two-chip colour area" ; 4 = "Three-chip colour area"; 5 = "Colour sequential area"; 7 = "Trilinear"; 8 = "Colour sequential linear" }
if ($image.Properties.Exists("41495")) { $content += "Sensing Method:" + $sensing[[int]$image.Properties.Item("41495").Value] + "`n" }
$filesrc = @{ 1 = "Film scanner"; 2 = "Reflection print scanner"; 3 = "Digital camera" }
if ($image.Properties.Exists("41728")) { $content += "File Source:" + $filesrc[[int]$image.Properties.Item("41728").Value] + "`n" }
$custrender = @{ 0 = "Normal"; 1 = "Custom" }
if ($image.Properties.Exists("41985")) { $content += "Custom Rendered:" + $custrender[[int]$image.Properties.Item("41985").Value] + "`n" }
$exposure = @{ 0 = "Auto"; 1 = "Manual"; 2 = "Auto Bracket" }
if ($image.Properties.Exists("41986")) { $content += "Exposure Mode:" + $exposure[[int]$image.Properties.Item("41986").Value] + "`n" }
$white = @{ 0 = "Auto"; 1 = "Manual" }
if ($image.Properties.Exists("41987")) { $content += "White Balance:" + $white[[int]$image.Properties.Item("41987").Value] + "`n" }
if ($image.Properties.Exists("41988")) { $content += "Digital Zoom Ratio:" + $image.Properties.Item("41988").Value + "`n" }
if ($image.Properties.Exists("41989")) { $content += "Focal Length in 35 mm Format:" + $image.Properties.Item("41989").Value + "`n" }
$scene = @{ 0 = "Standard"; 1 = "Landscape"; 2 = "Portrait"; 3 = "Night" }
if ($image.Properties.Exists("41990")) { $content += "Scene Capture Type:" + $scene[[int]$image.Properties.Item("41990").Value] + "`n" }
$gain = @{ 0 = "None"; 1 = "Low gain up"; 2 = "High gain up"; 3 = "Low gain down"; 4 = "High gain down" }
if ($image.Properties.Exists("41991")) { $content += "Gain Control:" + $gain[[int]$image.Properties.Item("41991").Value] + "`n" }
$contrast = @{ 0 = "Normal"; 1 = "Low"; 2 = "High" }
if ($image.Properties.Exists("41992")) { $content += "Contrast:" + $contrast[[int]$image.Properties.Item("41992").Value] + "`n" }
$saturation = @{ 0 = "Normal"; 1 = "Low"; 2 = "High" }
if ($image.Properties.Exists("41993")) { $content += "Saturation:" + $saturation[[int]$image.Properties.Item("41993").Value] + "`n" }
$sharpness = @{ 0 = "Normal"; 1 = "Soft"; 2 = "Hard" }
if ($image.Properties.Exists("41994")) { $content += "Sharpness:" + $sharpness[[int]$image.Properties.Item("41994").Value] + "`n" }
$sdr = @{ 0 = "Unknown"; 1 = "Macro"; 2 = "Close" ; 3 = "Distant" }
if ($image.Properties.Exists("41996")) { $content += "Subject Distance Range:" + $sdr[[int]$image.Properties.Item("41996").Value] + "`n" }
$image = $null
$rtbMetadata.Lines = $content
}
$handler_btPrepareToShareAll_Click={
$files = @( )
for ($i = 0; $i -lt $listboxFile.items.count; $i++) {
$files += $listboxFile.items.item($i)
}
Resize-Image -files $files
}
$handler_btPrepareToShare_Click={
$files = @( )
#foreach ($objItem in $listboxFile.SelectedItems) {$files += $objItem} # for MultiExtended
$files += $listboxFile.Text
Resize-Image -files $files
}
#----------------------------------------------
# Generated Events
#----------------------------------------------
$Form_StateCorrection_Load=
{
#Correct the initial state of the form to prevent the .Net maximized form issue
$formMain.WindowState = $InitialFormWindowState
}
#----------------------------------------------
#region Generated Form Code
#----------------------------------------------
#
# formMain
#
$formMain.Controls.Add($btPrepareToShareAll)
$formMain.Controls.Add($rtbMetadata)
$formMain.Controls.Add($listboxFile)
$formMain.Controls.Add($btPrepareToShare)
$formMain.Controls.Add($lbSaveFolder)
$formMain.Controls.Add($btSaveFolder)
$formMain.Controls.Add($pictbox)
$formMain.Controls.Add($lbImageFolder)
$formMain.Controls.Add($btImageFolder)
$formMain.ClientSize = New-Object System.Drawing.Size(792,573)
$formMain.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$formMain.Name = "formMain"
$formMain.Text = "Image Resizer"
$formMain.add_Load($FormEvent_Load)
#
# btPrepareToShareAll
#
$btPrepareToShareAll.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$btPrepareToShareAll.Location = New-Object System.Drawing.Point(17,538)
$btPrepareToShareAll.Name = "btPrepareToShareAll"
$btPrepareToShareAll.Size = New-Object System.Drawing.Size(184,23)
$btPrepareToShareAll.TabIndex = 9
$btPrepareToShareAll.Text = "Prepare to Share All Image"
$btPrepareToShareAll.UseVisualStyleBackColor = $True
$btPrepareToShareAll.add_Click($handler_btPrepareToShareAll_Click)
#
# rtbMetadata
#
$rtbMetadata.BackColor = [System.Drawing.Color]::FromArgb(255,212,208,200)
$rtbMetadata.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$rtbMetadata.ForeColor = [System.Drawing.Color]::FromArgb(255,0,0,0)
$rtbMetadata.Location = New-Object System.Drawing.Point(438,69)
$rtbMetadata.Name = "rtbMetadata"
$rtbMetadata.ReadOnly = $True
$rtbMetadata.Size = New-Object System.Drawing.Size(342,492)
$rtbMetadata.TabIndex = 8
$rtbMetadata.Text = ""
#
# listboxFile
#
$listboxFile.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$listboxFile.FormattingEnabled = $True
$listboxFile.Location = New-Object System.Drawing.Point(17,69)
$listboxFile.Name = "listboxFile"
#$listboxFile.SelectionMode = [System.Windows.Forms.SelectionMode]::MultiExtended
$listboxFile.Size = New-Object System.Drawing.Size(400,134)
$listboxFile.TabIndex = 6
$listboxFile.add_SelectedIndexChanged($handler_listboxFile_SelectedIndexChanged)
#
# btPrepareToShare
#
$btPrepareToShare.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$btPrepareToShare.Location = New-Object System.Drawing.Point(233,538)
$btPrepareToShare.Name = "btPrepareToShare"
$btPrepareToShare.Size = New-Object System.Drawing.Size(184,23)
$btPrepareToShare.TabIndex = 5
$btPrepareToShare.Text = "Prepare to Share Selected Image"
$btPrepareToShare.UseVisualStyleBackColor = $True
$btPrepareToShare.add_Click($handler_btPrepareToShare_Click)
#
# lbSaveFolder
#
$lbSaveFolder.BorderStyle = [System.Windows.Forms.BorderStyle]::FixedSingle
$lbSaveFolder.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$lbSaveFolder.Location = New-Object System.Drawing.Point(156,39)
$lbSaveFolder.Name = "lbSaveFolder"
$lbSaveFolder.Size = New-Object System.Drawing.Size(624,23)
$lbSaveFolder.TabIndex = 4
#
# btSaveFolder
#
$btSaveFolder.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$btSaveFolder.Location = New-Object System.Drawing.Point(17,39)
$btSaveFolder.Name = "btSaveFolder"
$btSaveFolder.Size = New-Object System.Drawing.Size(133,23)
$btSaveFolder.TabIndex = 3
$btSaveFolder.Text = "Select Save Folder"
$btSaveFolder.UseVisualStyleBackColor = $True
$btSaveFolder.add_Click($handler_btSaveFolder_Click)
#
# pictbox
#
$pictbox.BorderStyle = [System.Windows.Forms.BorderStyle]::FixedSingle
$pictbox.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$pictbox.Location = New-Object System.Drawing.Point(17,220)
$pictbox.Name = "pictbox"
$pictbox.Size = New-Object System.Drawing.Size(400,300)
$pictbox.SizeMode = [System.Windows.Forms.PictureBoxSizeMode]::StretchImage
$pictbox.TabIndex = 2
$pictbox.TabStop = $False
#
# lbImageFolder
#
$lbImageFolder.BorderStyle = [System.Windows.Forms.BorderStyle]::FixedSingle
$lbImageFolder.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$lbImageFolder.Location = New-Object System.Drawing.Point(156,11)
$lbImageFolder.Name = "lbImageFolder"
$lbImageFolder.Size = New-Object System.Drawing.Size(624,23)
$lbImageFolder.TabIndex = 1
#
# btImageFolder
#
$btImageFolder.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$btImageFolder.Location = New-Object System.Drawing.Point(17,11)
$btImageFolder.Name = "btImageFolder"
$btImageFolder.Size = New-Object System.Drawing.Size(133,23)
$btImageFolder.TabIndex = 0
$btImageFolder.Text = "Select Image Folder"
$btImageFolder.UseVisualStyleBackColor = $True
$btImageFolder.add_Click($handler_btImageFolder_Click)
#endregion Generated Form Code
#----------------------------------------------
#Save the initial state of the form
$InitialFormWindowState = $formMain.WindowState
#Init the OnLoad event to correct the initial state of the form
$formMain.add_Load($Form_StateCorrection_Load)
#Show the Form
return $formMain.ShowDialog()
} #End Function
# Test WIA is installed by testing if "%WINDIR%\system32\wiaaut.dll" exist and
$testWIA = New-Object -ComObject Wia.ImageFile
if ($testWIA -eq $isnull) {
Write-Host "Windows Image Acquisition Library dll seems to be not registered"
Exit
}
$wiafile = "$env:WINDIR\system32\wiaaut.dll"
if (!(Test-Path($wiafile))) {
Write-Host "Windows Image Acquisition Library dll $wiafile is installed but not registered. Run this next commandline to registered it:"
Write-Host "regsvr32 C:\windows\system32\wiaaut.dll"
Exit
}
#Call OnApplicationLoad to initialize
if(OnApplicationLoad -eq $true)
{
#Create the form
GenerateForm | Out-Null
#Perform cleanup
OnApplicationExit
}
No comments:
Post a Comment