CasparCG

Automate CasparCG from PowerShell using this .Net library

Download the 3 CasparCGNetConnector files from https://github.com/mcdikki/CasparCGNetConnector/tree/master/CasparCGNETConnector/bin/Release and place them in your \Documents\WindowsPowerShell directory (don’t forget to un-block them).

PowerShell code to send raw ACMP commands


add-type -path 'C:\Users\Imorrish\Documents\WindowsPowerShell\CasparCGNETConnector.dll'
$casparcg = new-object "CasparCGNETConnector.CasparCGConnection"
$casparcg.connect("videopc",5250)
$casparcg.sendCommand("play 1-1 ARISE_HeyO")
$casparcg.close()

Next, create a CasparCG folder in your Documents\WindowsPowerShell\Modules directory and place the psm1 and psd1 files from my PowerShell Module can be downloaded from https://github.com/imorrish/GasparCG-PowerShell

It provides syntax helpers for complex CasparCG methods

Run PowerShell ISE and type Import-Module CasparCG

Try typing New-Command and you should see the type ahead and parameter hint.

Example PowerShell code to use the module


add-type -path 'C:\Users\Imorrish\Documents\WindowsPowerShell\CasparCGNETConnector.dll'
Install-Module casparcg
$casparcg = new-object "CasparCGNETConnector.CasparCGConnection"
$casparcg.connect("videopc",5250)
$Cut = [CasparCGNETConnector.CasparCGTransition]::New("CUT", 200)
$PlayColourTunnel = New-PlayCommand -channel 1 -layer 1 -media "Video1" -looping $False -transition $Cut
$PlayColourTunnel.execute([ref]$casparcg)
$PlayColourTunnel.getResponse()