Target helpers

Function Returns Description
GetTargetById(Id) AbstractTarget or null Searches every scene for a target whose Id matches the given GUID string (case-insensitive). Returns the matching target, or null if none is found.
GetTargetByName(sceneName, targetName) AbstractTarget or null Returns the named scene target, or null if the scene or target is missing.
ExecuteTargetCommand(sceneName, targetName, commandName) bool Executes a named Command property on the named target within the named scene, using reflection. Returns false if the target is missing, the command property does not exist, or the command's CanExecute is false.
ExecuteTargetCommandById(targetId, commandName) bool Executes a named Command property on a target identified by its GUID (case-insensitive), searching every scene. Returns false if the target is missing, the command property does not exist, or the command's CanExecute is false.
// Start a target on connector trigger
function OnConnectorStartStream() {
    var ok = Project.ExecuteTargetCommand("Scene", "SRT Output", "StartCommand");
    return { result: ok ? "ok" : "error", httpStatus: ok ? 200 : 500 };
}