Using CitectSCADA > Monitoring and Debugging Runtime > Using the Kernel > Cicode
Cicode

Opens a child window that you can use to call Cicode functions, on either a local or remote computer. Any built-in or user-written function can be called from this window.

Syntax

Cicode [<Name>]

Where:

<Name>

Optionally the name of a Citect Server (for example, Alarms, Reports, Trends) or a client computer name.

If you enter the Cicode command with no Name argument, a local Cicode window is created.Cicode commands are executed on the local computer.

In a multi-cluster systems when connecting to a server, the following syntax needs to be specified:

<clustername>.<server>

For example, to connect to the Alarm Server on Cluster1, use:

Cicode Cluster1.Alarm

If you enter a server or computer name as the Name argument, you can create a Cicode window to the remote server or computer. Cicode commands entered in a remote Cicode window are executed on the remote computer. For example, to create a Cicode window where commands execute on the Alarm Server, use:

Cicode Alarm

If you issue the command from a server, you can create a window to the "MyComputer" computer:

Cicode MyComputer

If the remote computer can be found, its name is displayed in the title of the Cicode window, otherwise a local window is created.

Note: You can only specify a computer name if you are issuing the command on a server. This function only supports Client to Server or Server to Client connection.

Each Cicode command is executed with its own Cicode task, so you can start tasks that take a long time to complete. The Cicode prompt returns immediately after the Cicode task has started and the task continues to run in the background. If the function is completed immediately, the return result of the function is displayed. If the function continues to run, the result is not displayed and cannot be returned - the message "Task still running" and the task handle is returned instead.

Note: Remember that there is no Privilege check on any command issued from this window, so you have full access to the system.

The Cicode prompt 0:> shows the current window number with which any object is associated. To change the current window, use the WinGoto() function (or any other Cicode function that affects the current window).

The Cicode window does not recognize any variable names, so when you call a Cicode function, you can only pass constants (for example numbers or strings). When you call a function that expects a string, pass a string constant, for example Prompt("Hello from the Kernel"). If the string is only a single word, you do not have to use delimiters, for example Prompt(Hello). The Cicode window tries to convert whatever you enter (as arguments) into the correct data type. If it cannot convert the arguments, it passes either 0 (zero) or an empty string to the function.

Note: Some Cicode functions are implemented as label macros by the compiler. These macros allow backward compatibility when the number of arguments to a function has been changed. Because the Cicode window does not expand macros, you cannot call these functions directly. You need to use the macro expansion. If the function you are trying to use cannot be found, try again by adding an underscore (_) to the front of the function name, for example _DevClose(1).
You can also shut down the Citect system from this window by using the Shutdown() function.

See Also