Documentation
IPS_GetScriptIDByName
int IPS_GetScriptIDByName (string $ScriptName, int $ParentID)
Parameters
| ScriptName | Name of the script |
| ParentID | Object whose direct 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.
In addition to the name, this function uses an additional criterion (ParentID) for the search. Thus, the probability to find the intended ID is considerably larger. Remember:
Caution: Names in IP Symcon can be chosen freely, so they are not unique. For this reason, the function can return a wrong ID.
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 found!";
else
echo "The Script ID is: ". $ScriptID;