Skip to content

Instantly share code, notes, and snippets.

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
# 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
$result = $watcher.WaitForChanged([System.IO.WatcherChangeTypes]::Changed -bor [System.IO.WatcherChangeTypes]::Renamed -bOr [System.IO.WatcherChangeTypes]::Created, 1000);
ATEMUploadImage "c:\data\images\$($result.Name)" 6 ""

This comment has been minimized.

Copy link
Owner Author

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.