The external command programming interface contains the functions described below.
IMPORTANT: These functions require ICMD.NLM 2.18 or later.
Use the ICMDSetVar function to set a script variable programmatically.
int ICMDSetVar (char *variableName, char *variableValue)
*variableName: Pointer to name of variable to set
*variableValue: Pointer to string representing value of variable being set
0 if successful; non-zero error code if unsuccessful.
ICMDSetVar is a function exported by ICMD.NLM that another NLM can call (for instance, in a blocking NLMExec command). This lets the NLM set a variable within a script being executed by ICMD.NLM so the NLM can communicate with the script, changing the control flow, etc.
If MYNLM.NLM has code as follows:
ICMDSetVar("mynlmvar", "hello world"); exit();
and the script looks like this:
NLMExec 1, mynlm
Display 0, "Information: %{mynlmvar}"
then this popup text box would be displayed:
Information: hello world
Use the ICMDGetVar function to get the value of a script variable.
int ICMDGetVar (char *variableName, char *variableValue)
*variableName: Pointer to name of variable
*variableValue: Buffer containing value of variable; must be at least 128 bytes
0 if successful; non-zero error code if unsuccessful or if variableName does not exist.
ICMDGetVar is a function exported by ICMD.NLM that another NLM can call. This lets the NLM set a variable within a script being executed by ICMD.NLM so the NLM can communicate with the script, changing the control flow, etc.
If a script looks like this:
SetVar myvar, "Hello"
NLMExec 1, mynlm
and if MYNLM.NLM has code as follows:
char buffer[128];
ICMDGetVar("myvar", buffer);
then the value in buffer would be the null-terminated string:
"Hello".