« Back to Product

Documentation

IPS_GetScriptIDByName

 int IPS_GetScriptIDByName (string $ScriptName, int $ParentID) 

Parameters

ScriptName

Name of the script

ParentID

Object whose child objects are searched for the script

Returns

ID of the found script, otherwise FALSE

Description

This function tries to determine the ID of a script with the name ScriptName and the parent with the ID ParentID. It returns the ID of the first found script whose name matches with ScriptName. If such a script is found, its ID is returned, otherwise FALSE.

Compared to IPS_GetScriptID, this function uses an additional criterion (ParentID) for the the search. Thus, the probability to find the intended ID is considerably larger. Remember:

Warning

Caution: Names in IP Symcon can be chosen freely, so they are not unique. For this reason, the command can return a wrong ID.

Warning

This function generates a warning if the name was not found. Use the @ operator, if you want to suppress this message. The exact function of this operator is described in the PHP manual.

Example

$ScriptID = @IPS_GetScriptIDByName("Rain sensing", $ParentID);
if ($ScriptID === false)
    echo "Script not foung!";
else
    echo "The Script ID is: ". $ScriptID;
Any questions?