Created
July 24, 2018 06:48
-
-
Save imorrish/07d6b27398addedeff2699f42da5efcf to your computer and use it in GitHub Desktop.
PowerShell script to monitor folder for new/changed image and upload to ATEM media pool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See https://ianmorrish.wordpress.com/atem-command-line-utilites/ for download utility links