Seiki Batch Script > Structure

Machines

Getting information from the NMS4 machine database uses the $dde( ) function. Actually this function can obtain information from any program that is a Dynamic Data Exchange service but it defaults to NMS4.

An example is to ask for the status of a machine. The function

$dde("MACHINE_STATUS_AS_CODE", "HICELL1")

returns a value that is string containing a two digit  number, such as "23" which represent a status made up from status group 2 and status sub-status 3. Beware as statuses count from 0 not 1 so your eight statuses are 0 through 7 and the sub-statuses are 0 through 7 also.

The $dde function always returns a string so if you want the number as a number use n = dde(...) which will give a number between 0 and 77. Then use n/10 to give the major status and n%10 (remainder after division) to give the minor status.

$dde normally takes two parameters the first being the item you require and the second being the machine name. The current list of available parameters contains:

MACHINE_STATUS_AS_TEXT

MACHINE_STATUS_AS_CODE

MACHINE_STATUS_AS_TIME

MACHINE_JOB_ID

MACHINE_JOB_DIRECTORY

MACHINE_WORKS_ORDER

MACHINE_PARTS_REQUIRED

MACHINE_PARTS_REMAINING

MACHINE_PARTS_GOOD

MACHINE_PARTS_SCRAP

Remember that the $dde( ) function returns the actual value which is a string while dde( ) reads the string then returns the integer value it contains. While this is appropriate for a value that is a number such as MACHINE_PARTS_GOOD it will return zero for MACHINE_STATUS_AS_TEXT.

In its more general form $dde( ) takes three parameters being the standard DDE server, topic and item. If you need to use Dynamic Data Exchange to talk to another program then its documentation should spell out what you need to provide for these values. If you only provide two then NMS4 is assumed to be the DDE source.