Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PowerShell script to monitor folder for new/changed image and upload to ATEM media pool
# File System Watcher to upload image to ATEM media pool
Function ATEMUploadImage
{
param
(
[String]$File,
[Int]$Slot,
[string]$ATEMip
)
# Just use command line utility as dll may conflict with JustMacros
Write-Output "Uploading image $($File)"
$exe = "C:\utils\mediaupload.exe"
& $exe $ATEMip $Slot $File
}
#create watcher
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path ="C:\data\images"
$watcher.IncludeSubdirectories = $false
$watcher.EnableRaisingEvents = $false
$watcher.NotifyFilter = [System.IO.NotifyFilters]::LastWrite -bor [System.IO.NotifyFilters]::FileName
#wait in loop for file
while($TRUE){
$result = $watcher.WaitForChanged([System.IO.WatcherChangeTypes]::Changed -bor [System.IO.WatcherChangeTypes]::Renamed -bOr [System.IO.WatcherChangeTypes]::Created, 1000);
if($result.TimedOut){
continue;
}
ATEMUploadImage "c:\data\images\$($result.Name)" 6 "192.168.1.8"
}
@imorrish

This comment has been minimized.

Copy link
Owner Author

imorrish commented Jul 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.