Go to documentation repository
The GetObjectIdByParam method allows receiving you to get the ID of an object ID at which , some parameter of which is equal to the specified value. The first found object ID is receiving if If there are several such objects. The null is receiving if , the ID of the first found object is returned. If no such objects are not found, 0 is returned.
Syntax of for method invocation:
| Code Block | ||
|---|---|---|
| ||
function GetObjectIdByParam (obj_type : String, obj_param : String, param_value : String) |
Method arguments:
Example. Find cameras from which with a black-and-white video image is receiving and set the the Color parameter equals to 1 for them.
| Code Block |
|---|
if (Event.SourceType == "MACRO" && Event.SourceId== "1" && Event.Action == "RUN")
{
var id = GetObjectIdByParam("CAM","color","0"); //receivingget the first object ID
while (id){ //while exist the Camera objects from which black-and-white image is receivingreceived
SetObjectParam ("CAM", id, "color", "1"); //change the Color parameter for found object
id = GetObjectIdByParam("CAM","color","0"); //receivingget the next object ID
}
} |