Trademarks and copyrights Notice Notice OMRON products are manufactured for use by a trained operator and only for the purposes described in this manual. The following conventions are used to classify and explain the precautions in this manual. Always heed the information provided with them.
SECTION 2 Expressions..................13 SECTION 3 Scripts .....................17 Object..............................17 Page..............................17 Project ..............................17 SECTION 4 CX-Supervisor Script Language ...........19 Points ..............................20 4-1-1 Basic Point Assignment ......................20 4-1-2 Further Point Assignment ..................... 20 Logic and Arithmetic........................... 21 4-2-1 Arithmetic Operators ......................
Page 5
Table of Contents Using Aliases ............................. 33 SECTION 5 VBScript Language Reference .............37 List of Features: ..........................37 SECTION 6 Functions and Methods..............41 Object Commands ..........................45 6-1-1 Current Object ........................45 6-1-2 Other Objects ........................46 6-1-3 Blink............................47 6-1-4 Colour ...........................
Introduction This reference manual describes the script language syntax as a supplement to the CX-Supervisor User Manual. It provides detailed definition of the syntax of CX-Supervisor scripts that drive project, page, object actions and CX- Supervisor expressions as used by objects and scripts.
Operands are constants or point variables. Expressions can be used in a script as part of a statement (refer to chapter 3 Scripts, chapter 4 CX-Supervisor Script Language, and Chapter 6 Functions and Methods). However expressions can be applied to the following actions directly using the associated Expression: or Digital Expression: field: •...
Page 15
Operators used within this example are fully described in chapter 4, Logic and Arithmetic. The following example of an expression contains a value point 'prompt' which is included at the value position denoted by a '#' symbol. Refer to the CX-Supervisor User Manual for detailed dialog descriptions.
When using Boolean operators (e.g. ==, !=, &&, ||, |) never mix tests for Boolean and non Boolean operands. For example never use "bMyFlagPoint == 1" or "bMyFlagPoint == 0". Instead always test using the correct Boolean constant i.e. "TRUE" or "FALSE" for CX-Supervisor scripts, or "True" and "False" when using VBScript. Note: On Condition scripts are only executed when the expression is TRUE.
SECTION 3 Scripts A CX-Supervisor script is a simple programming language used to manipulate points. Scripts can be created at different levels, at object level, page level or project level. Although the script code can be applied to all levels of script, there are subtle differences, described in the following paragraphs.
CX-Supervisor Script Language This chapter describes the CX-Supervisor script language syntax. It provides a detailed definition of the syntax of CX-Supervisor scripts that drive project, page and object actions, and CX-Supervisor expressions as used by objects and scripts. In conjunction with the script functions and methods described in Chapter 6, the CX-Supervisor script language provides a very powerful, compiled, fast and full featured programming language.
Points SECTION 4 CX-Supervisor Script Language Points 4-1-1 Basic Point Assignment Syntax pointname = expression Remarks Argument Description pointname The point name to be assigned a value. expression The value to be assigned to pointname. The expression may be of type Boolean, Integer, Real or Text.
Logic and Arithmetic SECTION 4 CX-Supervisor Script Language Typical Examples lift = height + rate/5.0 The Integer or Real point 'lift' is assigned the value calculated by the value of point 'rate' divided by 5, plus the value of point 'height'. Precedence can be changed by the introduction of parenthesis.
Logic and Arithmetic SECTION 4 CX-Supervisor Script Language 4-2-2 Bitwise Operators Syntax pointname = expression IF expression DO WHILE expression DO UNTIL expression Remarks Argument Description pointname The pointname to be assigned a value based on the bitwise operation. expression The value to be assigned to pointname, or to be evaluated as a Boolean expression.
Logic and Arithmetic SECTION 4 CX-Supervisor Script Language Argument Description Expression The Boolean value to be assigned to pointname or the Boolean value forming a conditional statement. The expression includes the following operators with points and constants: • And 'AND'.
Control Statements SECTION 4 CX-Supervisor Script Language The point 'fuel' is assigned the value 0 on the condition that currently, 'fuel' is less than 0. If 'fuel' is not less than 0, then it is not assigned the new value.
Control Statements SECTION 4 CX-Supervisor Script Language IF burner AND fuel > 0 AND rate > 0 THEN fuel = fuel - rate ELSE lift = 0 altitude = 0 ENDIF Provided that Boolean point 'burner' is ''TRUE'' AND points 'fuel' and 'rate' are greater in value than 0, then 'fuel' is assigned a new value.
Page 27
Control Statements SECTION 4 CX-Supervisor Script Language Argument Description conditionA The condition is made up of points and constants, using relational, logical or arithmetical notation as a test. The condition can evaluate Boolean state 'TRUE' and 'FALSE', Integer or Real numbers, or a text string.
Control Statements SECTION 4 CX-Supervisor Script Language Refer to chapter 4, Punctuation for details of the use of indentation. 4-3-3 Case Select Syntax SELECT CASE expression CASE expression statementblock1 CASE expression statementblock2 CASE expression statementblock3 END SELECT SELECT CASE expression...
Control Statements SECTION 4 CX-Supervisor Script Language SELECT CASE TRUE CASE temperature > 0 AND temperature <= 10 colour (blue) CASE temperature > 10 AND temperature <= 20 colour (green) CASE temperature > 20 AND temperature <= 30 colour (red)
Subroutines SECTION 4 CX-Supervisor Script Language In this example, the fill for 'Ellipse_1' is gradually removed 20 times (100 times/-5). Note: Loop statements should be used with caution, as they consume processor time while they are running and some other parts of the system may not be updated.
RETURN command are ignored. If the value of integer point 'limit' does not exceed 1000, then the RETURN command is not executed, and statements after the RETURN command are performed. References Refer to the CX-Supervisor User Manual for the use of the RETURN statement for Recipe validation. Punctuation 4-5-1...
Indirection within Script Commands and Expressions SECTION 4 CX-Supervisor Remarks Argument Type Description Comment - - - Descriptive text. Typical Examples REM The following statement adds two numbers result = 45 + 754 result = 45 + 754 'add two numbers...
Point Arrays within Script Commands and Expressions SECTION 4 CX-Supervisor 1, 2, 3… 1. Link the toggle button to a textpoint using indirection e.g. ^textpoint. 2. Link the following script code to run as required. e.g. on clicking a button.
Page 35
Using Aliases SECTION 4 CX-Supervisor Script Language The following illustration shows the Alias Definitions dialog displaying a number of User defined aliases. The System aliases are pre-defined and can not be edited or added to. Syntax: @AliasNameAlias definition 'optional comment...
Page 36
Using Aliases SECTION 4 CX-Supervisor Script Language @SecondsPerMinute = 60 ' sets duration Aliases may also be used to create a complicated expression such as @HYPOTENUSEsqrt(Opposite Opposite Adjacent Adjacent) 'Calculates length of Hypotenuse This can be used in a script in the following way: Opposite = 8.45...
Page 37
Using Aliases SECTION 4 CX-Supervisor Script Language...
List of Features: SECTION 5 VBScript Language Reference SECTION 5 VBScript Language Reference This chapter is a reference for the syntax of Microsoft Visual Basic scripting language called VBScript. These features are provided by the Windows Scripting Host, included by default with Windows 2000 and Windows XP. For a full User Guide, Language reference and details of the latest versions and support contact Microsoft at http://msdn.microsoft.com List of Features:...
Page 39
List of Features: SECTION 5 VBScript Language Reference Category Keyword / Feature Declarations Class Const Dim, Private, Public, ReDim Function, Sub Property Get, Property Let, Property Set Error Handing On Error Expressions Eval Excute RegExp Replace Test Formatting Strings FormatCurrency FormatDateTime FormatNumber FormatPercent...
Page 40
List of Features: SECTION 5 VBScript Language Reference Category Keyword / Feature Procedures Call Function, Sub Property Get, Property Let, Property Set Rounding Int, Fix, Round Script Engine ID ScriptEngine ScriptEngineBuildVersion ScriptEngineMajorVersion ScriptEngineMinorVersion Strings Asc, AscB, AscW Chr, ChrB, ChrW Filter, InStr, InStrB InStrRev Join...
Page 41
List of Features: SECTION 5 VBScript Language Reference...
SECTION 6 Functions and Methods This chapter describes the Functions and Methods available to the scripting language. In most cases, this can be CX-Supervisor script, VBScript or JScript. The following table describes the Functions and Methods at a glance. Function Name...
Page 43
SECTION 6 Functions and Methods Function Name Function Type Type Remarks disable object command OP Disables an object. DisableGroup point command All Prevents a group of points to be read or written. DisablePoint point command Scr Disables communications to a point.
Page 44
SECTION 6 Functions and Methods Function Name Function Type Type Remarks GetPerformanceInfo general Retrieves internal performance command and diagnostic values. GetPLCMode PLC command Retrieves the mode of a PLC. GetTextLength text command Specifies the number of characters in a text point. height object command OP Specifies the height of an object.
Page 45
PLC command Sets a phone number to a PLC. SetupUsers security Defines users and passwords for command Login. ShutDown gen. command Terminates CX-Supervisor. unary function Applies unary expression. sqrt unary function Applies unary expression. StartAuditTrail Data Logging Starts Audit Trail logging.
'OP' refers to Object and Page scripts only. Object Commands Object commands control native CX-Supervisor graphical objects, like rectangles or lines. Note: Objects are native to CX-Supervisor and therefore cannot be accessed or commands issued from external script languages, like VBScript or Jscript. 6-1-1 Current Object Syntax...
Chapter 6,Vertical Fill for use of the vertical fill command. • Chapter 6, Visible for use of the visible command. • Chapter 6, Width for use of the width command. "The CX-Supervisor User Manual for details of the Animation Editor. 6-1-2 Other Objects Syntax objectname.objectcommand pagename.objectname.objectcommand...
The specified object, 'POLYGON_1' is set to be red in colour. References Refer to: • CX-Supervisor User Manual for details of object names. • Chapter 6, Blink for use of the blink command. • Chapter 6, Colour for use of the colour command.
Object Commands SECTION 6 Functions and Methods Argument Description colour Colour to blink to. Some colour values within the colour palette have a meaningful colourID. This takes the form of the colour name, e.g., 'black' or 'yellow'. Alternatively, an integer value of 0x1000000 can be added to a number 0-65 to select a palette entry.
Object Commands SECTION 6 Functions and Methods Argument Description context This argument is optional an may be omitted. It defines which part of the object has it's colour changed. May be one or more of: @FILL - change fill colour @FRAME - changes frame colour If omitted both are changed.
Object Commands SECTION 6 Functions and Methods 6-1-6 Height Syntax objectname.height (expression, context) objectname.height = expression Remarks Argument Description objectname This is the name of the object. Where a script is directly attached to an object, objectname is not required. expression This is a value, point or an arithmetic expression returning a new height value in pixels.
Object Commands SECTION 6 Functions and Methods The object 'ELLIPSE_1' is filled from the right, provided the point 'GAS_LEVEL' returns a valid result, between 0 and 100. 6-1-8 Move Syntax objectname.move (x co-ordinate, y co-ordinate) Remarks Argument Description objectname This is the name of the object. Where a script is directly attached to an object, objectname is not required.
Object Commands SECTION 6 Functions and Methods Argument Description context This argument is not required and may be omitted. May be one of: @TOPLEFT - rotate around top left of object @TOPCENTRE -rotate around top centre of object @TOPRIGHT - rotate around top right of object @CENTRELEFT - rotate around centre left of object @CENTRE - rotate around centre of object @CENTRERIGHT - rotate around centre right of object...
Object Commands SECTION 6 Functions and Methods Typical Examples vertical%fill (50) The current object to which this example applies is filled by 50%. ELLIPSE_1.vertical%fill (OIL_QUANTITY, @DOWN) The object 'ELLIPSE_1' is filled provided the point 'OIL QUANTITY' returns a valid result, between 0 and 100. 6-1-11 Visible Syntax objectname.visible (expression)
Page Commands SECTION 6 Functions and Methods Page Commands Display Page Syntax display ("pagename") display ("pagename", X, Y) Remarks Argument Description pagename This is the name of the page for display, based on its filename without the file extension, e.g. the pagename for CAR.PAG is simply 'CAR'.
General Commands SECTION 6 Functions and Methods General Commands 6-3-1 Exponential Description Mathematical function to calculate a value raised to a power. Syntax result = Exp (value, exponent) Remarks Argument Type Description result integer Point name to receive returned result of value raised to the power of exponent.
General Commands SECTION 6 Functions and Methods Typical Example PlayOLE("ole_1",0) The object 'ole_1' is played using its primary verb. 6-3-3 DisplayPicture Description Reload a picture for a Picture object. Syntax returnstate = DisplayPicture("objectname", filename) Remarks Argument Type Description returnstate bool Returnstate is '1' if the function is successful, or '0' otherwise.
General Commands SECTION 6 Functions and Methods pointname = Rand(upperlimit) Remarks Argument Type Description upperlimit integer The maximum negative or positive integer value that the Rand function can generate. pointname Integer Point that contains the integer returned from point the Rand function. Typical Example randomnumber = Rand(upperlimit) A random integer in the range 0 to upperlimit is returned and contained in the...
General Commands SECTION 6 Functions and Methods Typical Example RunHelp("c:\myhelp.hlp",0) The helpfile c:\myhelp.hlp is run, and topic 0 shown. 6-3-8 SetLanguage Description Change the language of text on display. This will reload the system language file from the program folder (i.e. with a .LNG extension), and the user defined text from the application folder (i.e.
= ShutDown() Remarks Argument Type Description returnstate bool Returnstate is '1' if the function is successful, or '0' otherwise. Typical Example ShutDown() CX-Supervisor runtime operation is terminated. Communications Commands 6-4-1 CloseComponent Syntax Returnstate = CloseComponent(ComponentName, PLCName) Remarks Argument Type Description returnstate...
Communications Commands SECTION 6 Functions and Methods In this example, the PLC Data Monitor component monitoring the PLC 'MyPLC' is closed. Component = "Performance Monitor" PLC = "PLC06" OK = CloseComponent(Component, PLC) In this example, the Performance Monitor component monitoring the PLC 'PLC06' is closed.
Point Commands SECTION 6 Functions and Methods Argument Type Description returnstate bool Returnstate is '1' if the function is successful, or '0' otherwise. ComponentName text A Text point or text constant containing the name of the component to open. PLCName text Text point or text constant containing the name of the PLC that the component to open is...
Point Commands SECTION 6 Functions and Methods 6-5-5 EditPoint Syntax EditPoint(BoolPoint, Caption, OffText, OnText) EditPoint(AnalogPoint, Caption, MinValue, MaxValue, Keyboard) EditPoint(TextPoint, EchoOff, Keyboard) Remarks Argument Type Description BoolPoint point Name of Boolean point to be edited Caption Text Text Caption for Edit dialog OffText Text Text description for Boolean state 0...
Point Commands SECTION 6 Functions and Methods EnableGroup("<Default>") All points belonging to the '<Default>' group is enabled thus allowing values to be read\written. 6-5-7 EnablePoint Syntax returnstate = EnablePoint(pointname) Remarks Argument Type Description returnstate bool Returnstate is '1' if the function is successful, or '0' otherwise.
Point Commands SECTION 6 Functions and Methods The Boolean point 'point1' has its value set to 'FALSE'. References Refer to PLC operation manuals for a detailed description of ForceSet, and ForceReset. 6-5-10 ForceSet Syntax returnstate = ForceSet(pointname) Remarks Argument Type Description returnstate bool...
Point Commands SECTION 6 Functions and Methods Typical Example InitArray (MyArray, 0) In this example, all elements of the array 'MyArray' are set to 0. 6-5-13 InputPoint Syntax returnstate = InputPoint(pointname, returnflag) Remarks Argument Type Description returnstate bool Returnstate is '1' if the function is successful, or '0' otherwise.
Name of PLC to be opened. If the PLC is being accessed using a communications component, e.g. the Omron CX-Communications Control this parameter should be the control name and PLC name separated by a dot e.g. "OMRONCXCommunicationsControl.controlPL C".
PLC Commands SECTION 6 Functions and Methods The PLC called controlPLC is closed. No further communications with the PLC will take place until it is reopened. 6-6-2 DownloadPLCProgram Syntax returnstate DownloadPLCProgram(plcname, filename, processed) Remarks Argument Type Description returnstate bool Returnstate is '1' if the function is successful, or '0' otherwise.
Name of PLC to be opened. If the PLC is being accessed using a communications component, e.g. the Omron CX-Communications Control this parameter should be the control name and PLC name separated by a dot e.g. "OMRONCXCommunicationsControl.controlPL C".
PLC Commands SECTION 6 Functions and Methods Argument Type Description plcname string Name of PLC to be monitored. Typical Example PLCMonitor("controlPLC") The monitor dialog for the PLC called controlPLC is invoked. This dialog can be used to check PLC status, change mode, etc. 6-6-7 SetPLCMode Syntax...
Temperature Controller Commands SECTION 6 Functions and Methods Remarks Argument Type Description returnstate bool 1 if the function is successful otherwise 0. plcname string Name of PLC to upload the program from. filename string Name of the file on disk to upload the program to.
Temperature Controller Commands SECTION 6 Functions and Methods temp1 = TCAutoTune("e5ak",temp2) 6-7-2 TCBackupMode Syntax returnstate = TCBackupMode(TController,mode) Remarks Argument Type Description returnstate bool 1 if the function is successful otherwise 0. TController string This is a string representing the name of the temperature controller.
Temperature Controller Commands SECTION 6 Functions and Methods Argument Type Description paramID point This is a point depicting the required parameter range 0 to 22: 0: ControlMode. 1: Output. 2: InputShiftDelay (Bool) E5*F, E5*X, E5*J. 3: DisplayUnit. 4: PIDConstantDisplay (Bool) E5*F, E5*X, E5*J.
Temperature Controller Commands SECTION 6 Functions and Methods Argument Type Description mode point This is a point depicting the mode of operation and defines the operational mode of a temperature controller. 0: This specifies the temperature controller is in remote mode. 1: This specifies that the temperature controller is in local mode.
Temperature Controller Commands SECTION 6 Functions and Methods Note: This command was previously called TCSetpoint. 6-7-7 TCRunStop Syntax returnstate = TCRunStop(TController,mode) Argument Type Description returnstate bool 1 if the function is successful otherwise 0. TController string This is a string representing the name of the temperature controller.
1 if the function is successful otherwise 0. alarmname string This is the identifier of the alarm. Typical Example AcknowledgeAlarm("temphigh") The alarm 'temphigh' is acknowledged. References Refer to the CX-Supervisor User Manual for details of alarms. 6-8-2 AcknowledgeAllAlarms Syntax returnstate = AcknowledgeAllAlarms() Remarks Argument Type...
Alarm Commands SECTION 6 Functions and Methods References Refer to the CX-Supervisor User Manual for details of alarms. 6-8-4 ClearAlarmHistory Syntax returnstate = ClearAlarmHistory() Remarks Argument Type Description returnstate bool 1 if the function is successful otherwise 0. Typical Example ClearAlarmHistory() The alarm history window is cleared and the log is cleared.
Description returnstate bool 1 if the function is successful otherwise 0. Typical Example DisplayAlarmHistory() The alarm history window is displayed. References Refer to the CX-Supervisor User Manual for details of alarms. 6-8-8 DisplayAlarmStatus Syntax returnstate = DisplayAlarmStatus() Remarks Argument Type...
The point 'acknowledged' is assigned Boolean state ''TRUE'' if the 'temptoohigh' alarm is currently acknowledged. The point is assigned Boolean state 'FALSE' if the alarm is not currently acknowledged. References Refer to the CX-Supervisor User Manual for details of alarms. 6-8-11 IsAlarmActive Syntax pointname = IsAlarmActive("alarmname")
File Commands SECTION 6 Functions and Methods 6-9-2 CopyFile Syntax returnstate = CopyFile("sourcename", "destname") Remarks Argument Type Description returnstate bool Returnstate is '1' if the function is successful, or '0' otherwise. sourcename string Pathname of file to be copied. May include a "*"...
Write() script commands. Only one file can be open at a time. A file is created if it doesn't already exist. Files can be shared (for instance located on a network drive, and accessed by several running CX-Supervisor applications simultaneously - this can be used for data exchange).
Script commands that have textual arguments can take either literal strings within quotes or text points. Note: CX-Supervisor uses the OLE registration information (file extension associations) to decide how to print a file. It invokes the parent application associated with a particular file extension, instructing the application to start minimised and passing the "print"...
The text point which holds the characters read point from the file. Noofchars integer The number of characters to read from the file. Typical Example ReadMessage ("C:\CX-SUPERVISOR\TESTFILE.TXT", TextPoint, 20) first characters read from file "C:\CX- SUPERVISOR\TESTFILE.TXT" and stored in the point 'TextPoint'.
File Commands SECTION 6 Functions and Methods TFile = SelectFile("Text Files (*.txt; *.csv)|*.txt;*.csv|Document Files (*.doc)|*.doc||") In this example, the 'Files of type' filter has 2 choices: one to show text files (i.e. both .txt and .csv files), and one to show document files (just .doc files). TFile = SelectFile("", "C:\WINDOWS") The 'File Open' dialog will be displayed, showing all files in the "C:\WINDOWS"...
Returnstate is '1' if the function is successful, or '0' otherwise. Typical Example DisplayRecipes() The current recipes is displayed. References Refer to the CX-Supervisor User Manual for details of recipes. 6-10-2 DownloadRecipe Syntax returnstate = DownloadRecipe("recipename") Remarks Argument Type...
Typical Example UploadRecipe("recipe1",done) The recipe 'recipe1' is uploaded, and point 'done' is set True when the upload is complete. References Refer to the CX-Supervisor User Manual for details of recipes. 6-11 Report Commands 6-11-1 GenerateReport Syntax returnstate = GenerateReport(ReportTemplateFile,ReportOutputFile)
Text Commands SECTION 6 Functions and Methods Argument Type Description ReportTemplateFil string Pathname of the report template file. ReportOutputFile string Pathname of the report output file. Typical Example PrintReport("report3.txt") The report template is processed, dynamically replacing the point names with current values, and printed to the default Windows printer.
Text Commands SECTION 6 Functions and Methods Typical Example BStr = Bin (20) In this example, 'Bstr' contains '10100'. 6-12-3 Chr Syntax result = Chr (value) Remarks Argument Type Description Value Extended ASCII value to convert to a character. result String containing single character representation of value.
Text Commands SECTION 6 Functions and Methods Note: The formatting characters are standard 'C' formatting characters (as used by the C-language sprintf function). Some commonly used types are: • %ld. Insert integer value; • %f. Insert decimal value. Prefix with decimal point and number to control position (for instance '%.2f' for 2 decimal places);...
Text Commands SECTION 6 Functions and Methods 6-12-7 Left Syntax lefttext = Left(textpoint,noofchars) Remarks Argument Type Description textpoint text The text point containing the string that is to be manipulated. noofchars integer The number of characters to extract from the start of the string.
The message 'print this message' is printed to the configured 'Alarm/message printer', queued if operating in page mode, or printing has been disabled by the EnablePrinting command. References Refer to the CX-Supervisor User Manual for further details to configure the 'Alarm/message printer'. 6-12-11 Right Syntax...
Event/Error Commands SECTION 6 Functions and Methods textpoint = "10.34" realpoint = TextToValue(textpoint) The real value 10.34 is assigned to the real point 'realpoint'. 6-12-13 ValueToText Syntax textpoint = ValueToText(value) Remarks Argument Type Description value integer The number that is to be placed into the textpoint.
Event/Error Commands SECTION 6 Functions and Methods Argument Type Description returnstate bool Returnstate is '1' if the function is successful, or '0' otherwise. Typical Example DisplayErrorLog() A list of all currently logged errors is displayed in a dialog. 6-13-4 EnableErrorLogging Syntax returnstate = EnableErrorLogging(pointname) Remarks...
Returnstate is '1' if the function is successful, or '0' otherwise. Typical Example ClearSpoolQueue() Any messages (typically printed alarms) that are queued up waiting to be sent to the CX-Supervisor Alarm/Message printer is discarded. 6-14-2 EnablePrinting Syntax returnstate = EnablePrinting(flag) Remarks...
Typical Example PrintPage("page1", TRUE) The CX-Supervisor page is sent to the printer. The flag 'TRUE' indicates that the print dialog is displayed first to allow for printer configuration. If 'FALSE' was specified instead of 'TRUE' then the print dialog is not shown, the page is just printed.
The Login dialog is displayed for user entry. Login("Designer", "Designer") The default 'Designer' user is logged in automatically using matching password. References Refer to the CX-Supervisor User Manual for details of Login. 6-15-2 Logout Syntax returnstate = Logout() Remarks Argument...
Returnstate is '1' if the function is successful, or '0' otherwise. Typical Example SetupUsers() The Setup Users dialog is displayed for user entry. References Refer to the CX-Supervisor User Manual for details of setting and modifying user details. 6-16 Data Logging Commands 6-16-1 ClearLogFile Syntax ClearLogFile("datasetname")
Data Logging Commands SECTION 6 Functions and Methods Typical Example CloseLogFile("Process 1") This command will close the active log file for the data set. Logging for this data set is automatically stopped. 6-16-3 CloseLogView Syntax CloseLogView("datasetname") Remarks Argument Type Description datasetname text Name of Data Set to close as text point or...
Data Logging Commands SECTION 6 Functions and Methods All these arguments are optional, and may be omitted provided there are no further arguments i.e. to specify the 'format', 'datasetname' and 'item list' must be included but 'file' and 'output' may be omitted. Typical Examples ExportAndViewLog("Balloon", "*") ExportAndViewLog("Balloon",...
Data Logging Commands SECTION 6 Functions and Methods Argument Type Description outputfile string File name for output file. May include full path, which will be created automatically if it does not exist. All these arguments are optional, and may be omitted provided there are no further arguments i.e.
OpenLogView("Balloon", ItemList, "C:\Program Files\Omron\CX-SUPERVISOR\App\MySessionInfo.txt") This command will open the Data Log Viewer and Balloon log file as above but the Data Log Viewer will always appear in the same position, and with the same settings - not as it was last shown.
Data Logging Commands SECTION 6 Functions and Methods 6-16-9 StopAuditTrail Syntax StopAuditTrail() Typical Example StopAuditTrail() This command will stop the current audit trail logging and close the audit trail database. 6-16-10 StartLogging Syntax returnstate = StartLogging("datasetname") returnstate = StartLogging("databaselink") Remarks Argument Type Description...
Database Commands SECTION 6 Functions and Methods 6-17 Database Commands 6-17-1 DBAddNew Description Adds a new record to a Recordset. This function will fail if the Recordset is opened with a lock of 'Read Only'. Syntax returnstate = DBAddNew(level) Remarks Argument Type Description...
Database Commands SECTION 6 Functions and Methods Closes a Connection or Recordset. Closing a Connection will automatically close all recordsets associated with it. Recordsets can be closed in isolation by selecting the appropriate level. Syntax returnstate = DBClose(level) Remarks Argument Type Description returnstate...
Page 106
Database Commands SECTION 6 Functions and Methods return = DBExecute(level, command, parameter) Remarks Argument Type Description return 1 if the function is successful otherwise 0 except for "Find" and "FindNext" commands which return the record number if found or if not, set the current record to EOF and return - level text...
Database Commands SECTION 6 Functions and Methods Command Connection Description Level RollbackTransAll Connection Cancels all changes and ends all transactions. TransCount Connection Returns the number of pending transactions. Requery Recordset Re-run the Recordset Query. CancelUpdate Recordset Cancel a DBAddNew operation. Find Recordset Find the specified criteria in a Recordset.
Page 108
Database Commands SECTION 6 Functions and Methods The DBMove function enables you to navigate around a Recordset by moving the position of the 'current record' in the Recordset. When a Recordset is first opened the first record is the current record. Syntax returnstate = DBMove(level, direction, position) Remarks...
Database Commands SECTION 6 Functions and Methods Note: Some Providers do not support moving in the "Previous" direction i.e. cursors are 'Forward-Only'. Some 'Forward-Only' providers do allow moving "First", while some are strictly Forward-Only i.e. the Recordset has to be Re-queried effectively a combined Close then Open operation to reset the cursor back to the start of the Recordset.
Database Commands SECTION 6 Functions and Methods Argument Type Description property text The name of the property to get. For details see the Recordset Properties and Field Properties tables. Typical Examples Page = DBProperty("CSV.Result", "CurrentPage") Get the current page for the CSV.Result Recordset. FieldSize = DBProperty("Northwind.Customers.Address", "Size") Get the size for the 'Address' field.
Database Commands SECTION 6 Functions and Methods values from the Recordsets current position will be copied into the Point (number of elements copied = number of elements in the Point, no paging applies at the Field level). Syntax returnstate = DBRead(level, reset) Remarks Argument Type...
Database Commands SECTION 6 Functions and Methods Argument Type Description command text The command must be one of the following: • "Read" - Transfers a schema page into the associated point • "Set" - Enables schema details to be modified •...
Database Commands SECTION 6 Functions and Methods Argument Type Description level text A text point or constant specifying the connection level. This may be a Connection or Recordset level. state text The requested state must be either "Open" or "Closed" Typical Examples State = DBState("Invoice", "Closed") Checks if the Connection "Invoice"...
Database Commands SECTION 6 Functions and Methods Remarks Argument Type Description return bool 1 if the specified level is in the requested state, otherwise 0 level text A text point or constant specifying the connection level. This may be a Connection or Recordset level.
Serial Port Functions SECTION 6 Functions and Methods 6-18 Serial Port Functions 6-18-1 InputCOMPort Description Sets the serial communications port for receiving ASCII text messages. Any message received is placed in the text point. The boolean flag is set true to indicate that a message has been received.
Serial Port Functions SECTION 6 Functions and Methods 6-18-3 CloseCOMPort Description Closes the designated serial communications port on the PC. The port must have been configured and opened before it can be closed. Syntax ReturnState = CloseCOMPort(PortNumber) Remarks Argument Type Description ReturnState bool...
ActiveX Functions SECTION 6 Functions and Methods Argument Type Description HandShaking Integer The required handshaking protocol. Valid values are 0 - None 1 - XonXoff 2 - RTS 3 - RTS & XonXoff TerminationChar Integer A character indicating the end of the message. ControlCharFlag Bool A flag indicating that control characters...
ActiveX Functions SECTION 6 Functions and Methods This will read the property 'DM' (with one parameter 100) from the OLE object 'CXComms1' and store it in the point 'DM100Value'. 6-19-2 PutProperty Description Puts a value stored in a point into the property of an OLE object. Syntax PutProperty(object, property, ..., value) Remarks...
ActiveX Functions SECTION 6 Functions and Methods 6-19-4 ExecuteVBScript Description Creates aliases allowing Visual Basic Script to be executed in line. This uses the Windows Scripting Host. See chapter 5 for a list of supported functions and details of the Windows Scripting Host. Syntax @VBSCRIPT @ENDSCRIPT...
Description This command is only used in conjunction with a remote connection using a CX-Supervisor Communications control (see User Manual Chapter 15, Connecting to remote applications). This command allows the Server machine to post unsolicited data back to the client machine. This data is captured in the client's "OnEvent"...
Page 121
ActiveX Functions SECTION 6 Functions and Methods...
Balloon Script SECTION 7 Script Example SECTION 7 Script Example This chapter provides an example application for a script. The script is a typical script exercising the basic commands. It is described twice, once as a whole, and once on a line by line basis. Balloon Script The following script applies to a simple game.
Page 123
Balloon Script SECTION 7 Script Example ENDIF ENDIF IF burner AND fuel > 0.0 AND rate > 0.0 THEN lift = lift + rate/5.0 ELSE IF alt > 140.0 THEN lift = lift - 0.2 ENDIF ENDIF IF lift < -10.0 THEN lift = -10.0 ENDIF alt = alt + lift...
Page 124
Balloon Script SECTION 7 Script Example IF alt > 140.0 THEN lift = lift - 0.2 ENDIF ENDIF If the fuel burner is on, and there is still fuel left, and the rate of ascent exceeds 0 (the balloon has taken off) then point 'lift' is incremented by the rate of ascent divided by 5 to allow the balloon to climb.
SECTION 8 Colour Palette SECTION 8 Colour Palette This chapter describes the colour palette. A colour may be specified by its name or number. The following table provides a cross-reference between these. Some colour names made up of more than one word are separated by an underscore or a hyphen.
"This is the name of the PC with the OPC Server. ServerName Name of the OPC Server to connect to. e.g. OMRON.OpenDataServer.1 ServerProjectName Optional filename, which if specified causes the OPC Server to use the specified file, if supported by the server.
Functions Appendix A OPC Communications Control Note: 'Value' is the default property so is assumed if omitted. Therefore, the following examples are the same: intVal = OMRONCXOPCCommunicationsControl1.Value("MyGroup", "BoilerTemp") intVal = OMRONCXOPCCommunicationsControl1 ("MyGroup", "BoilerTemp") A.3.2 Read Reads the value of an OPC item. Example of synchronous read: intVal = OMRONCXOPCCommunicationsControl1.Read...
Functions Appendix B CX-Server Communications Control Appendix B CX-Server Communications Control When the Project Settings->Advanced settings option "Allow advanced script access to PLC via 'CXServer' control" option is selected a CX-Server Communications Control is automaticalled created to allow script access to CX-Server functions.
Value Appendix B CX-Server Communications Control Active Function for returning the connection status of a specified PLC. TCGetStatus Function for returning the device status of a specified temperature controller TCRemoteLocal Function for switching a specified temperature controller into Remote or Local mode SetDeviceAddress Sets PLC Network, Node, and Unit number and IP address SetDeviceConfig...
SetDefaultPLC Appendix B CX-Server Communications Control B.4 SetDefaultPLC The 'SetDefaultPLC' function can be used to inform the script parser that a particular PLC is has been set as the default. Once a default PLC has been set, then it is not necessary (with some functions) to specify a PLC name. For example, CXServer.SetDefaultPLC("MyPLC") intVal = CXServer.Value("BoilerTemp1")
The script will wait for the read operation to complete before continuing to execute the next line. Note: If accessing from a CX-Supervisor script, the following integral values should be used for the return type: Constant...
WriteArea Appendix B CX-Server Communications Control Constant Value Description vbArray 8192 Array B.10 WriteArea Writes a block of memory to a specified area in a PLC. Examples of synchronous write: MyString = "TestString" CXServer.WriteArea "MyPLC/DM50", 10, MyString Dim newValue(2) newValue(1) = 0 newValue(2) = 1 CXServer.WriteArea "BoilerTemp",2,newValue In the first example, the contents of 'MyString' will be written into DM50 to...
ListPLCs Appendix B CX-Server Communications Control All PLC memory functions (e.g. A, AR, D, DM etc.) work in exactly the same way. The following examples use the DM function to get and set the value of a DM address in a PLC. Example 1 intVal = CXServer.DM(100) In this example, the contents of DM100 will be read from the PLC and stored...
CXServer.ClockWrite "PLC1", NewDate B.20 RawFINS This function enables raw FINS commands to be sent to a specified PLC. This function is for advanced users familiar with the Omron FINS protocol only. VBScript Example Dim sFINS Dim sResponse sFINS = "0501"...
= CXServer.Active("MyPLC") ' bActive is a CX- Supervisor point In this example, the connected status would be read from 'MyPLC' and stored in CX-Supervisor point 'bActive'. If 'MyPLC' is connected 'bActive' would be set to True. B.22 TCGetStatus Return status data for the specified temperature controller.
Section = "ADDRESS", Entry = "IPADDR", Setting = "0.0.0.0"..Setting = "255.255.255.255" - this can be used to set the Ethernet IP address Other parameter values may work, but should only be used on Omron advice. B.26 GetDeviceConfig This is a function that can be used to read any element of the CX-Server device configuration.
UploadProgram Appendix B CX-Server Communications Control B.27 UploadProgram The UploadProgram function can be used to read a program from a PLC. The program is read in binary form, and stored in a user-specified file. This function should not be used at the same time as any other PLC communications. The project and PLC will automatically be opened if required.
LastErrorString Appendix B CX-Server Communications Control PasswordString = "Password" PasswordNumber = 0 CXServer.Protect "PLC1", EnableProtection, PasswordString, PasswordNumber Example 2 (unsets protection for C series PLC) Dim SetProtection Dim PasswordString Dim PasswordNumber EnableProtection = false PasswordString = "" PasswordNumber = 12345678 CXServer.Protect "PLC1", EnableProtection,...
Page 141
LastErrorString Appendix B CX-Server Communications Control...
Appendix C JScript Features Appendix C JScript Features This appendix provides a summary of JScript features available for use with the ExecuteJScript and ExecuteJScriptFile script functions. These features are provided by the Windows Scripting Host, included by default with Windows 98, Windows ME, Windows 2000 and Windows XP and installed by Internet Explorer 4.0 and later.
Page 143
Appendix C JScript Features Category Keyword / Feature Global Methods Global escape, unescape eval isFinite, isNaN parseInt, parseFloat Maths Math abs, acos, asin, atan, atan2, ceil, cos, exp, floor, log, max, min, pow, random, round, sin, sqrt, tan, E, LN2, LN10, LOG2E, LOG10E, PI, SQRT1_2, SQRT2 Numbers Number MAX_VALUE, MIN_VALUE...
Number of milliseconds to wait before continuing. Typical Example Sleep (1000) CX-Supervisor waits 1 second. Note: The sleep statement should be used with caution, as some other parts of the system may not be updated while a script is sleeping. It also uses multithreading which means some tasks like PLC communication may occur in parallel and behave unpredictably.
Operating Systems, and tools like Microsoft Excel. This technology has now been replaced and the CX-Supervisor Communications Control should be used instead. The following DDE script commands are obsolete.
DDE Commands Appendix D Obsolete Features Argument Type Description topic String This contains the name of the topic recognised by the server application. Typically, a topic is a document within an application. At runtime, the topic must be open or a value cannot be returned and an error is reported.
DDE Commands Appendix D Obsolete Features Argument Type Description channel Integer This is an integer point which contains the point return value of the DDEInitiate() command. Both server and topic parameters applied to the in the DDEInitiate() command must be open or an error is reported.
DDE Commands Appendix D Obsolete Features D.3.6 DDETerminate Syntax returnstate = DDETerminate(channel) Remarks Argument Type Description returnstate bool Returnstate is '1' if the function is successful, or '0' otherwise. channel Integer This is an integer point which contains the point return value of the DDEInitiate() command.
Graph Commands Appendix D Obsolete Features D.4 Graph Commands D.4.1 ClearGraph Syntax returnstate = ClearGraph("graphid", "pagename") Remarks Argument Type Description returnstate bool Returnstate is '1' if the function is successful, or '0' otherwise. graphid string The identifier of the trend or scatter graph to be cleared.
Import Data provides the ability to load in a previously saved trend graph file. • Export Data provides the ability to store a snapshot to a file, either in internal CX-Supervisor format, or as a text file that can be imported into other applications. • Delete removes the currently selected snapshot.
Graph Commands Appendix D Obsolete Features D.4.5 SaveGraph Syntax returnstate = SaveGraph("graphid") Remarks Argument Type Description returnstate bool Returnstate is '1' if the function is successful, or '0' otherwise. graphid string The identifier of the trend or scatter graph to be saved.
Alarm/Message printer. Typical Example NumberMessages = GetSpoolCount() The count of the number of messages (typically printed alarms) that are queued up waiting to be sent to the CX-Supervisor Alarm/Message printer is returned. D.4.9 SetPrinterConfig Syntax returnstate StePrintConfig(Driver, Device, Port)
Page 153
Graph Commands Appendix D Obsolete Features SetPrinterConfig("SCSPRN", "", "LPT1:") This uses standard CX-Supervisor line print driver. SetPrinterConfig("", "", "") This uses default Windows printer driver. SetPrinterConfig("Epson9", "", "LPT2:") This uses Epson printer driver, attached to LPT2. SetPrinterConfig(DriverNamePoint, DeviceNamePoint, PrintNamePoint) This uses text points.
Bitmap The representation of an image stored in a computer's memory. Each picture element (pixel) is represented by bits stored in the memory. In CX-Supervisor a bitmap image can be installed as a single object. Boolean type A type of point where the value of the point can be one of two states.
Page 155
PLC device and address information and to communicate with OMRON PLCs and their supported network types. Constant Within CX-Supervisor, a constant is a point within the script language that takes only one specific value. Control Object In CX-Supervisor, a control object is applied in the...
Page 156
DLL files have a *.DLL extension. DLL's comprise a number of stand-alone functions. In CX-Supervisor, a DLL containing icons can be accessed to represent the display part of an OLE object. One such DLL, 'MORICONS.DLL', is provided in the standard Microsoft Windows installation.
Page 157
CX-Supervisor Point and a particular field (i.e. column) within a recordset. Graphic Object In CX-Supervisor, a graphic object is created in the development environment, and can be a line, an arc, a polygon (including a square and rectangle), a round rectangle, an ellipse (including a circle), or a polyline.
'FALSE', then NOT returns 'TRUE'. If a is a statement and is 'TRUE', then NOT returns 'FALSE'. Object In CX-Supervisor, an object can be text, graphics, a control, a bitmap, or ActiveX object as created in the development environment. A complex object can exist as a combination of two or more objects of any of the above types.
Page 159
See also Boolean type, Integer type, point variable, Real type and Text type. Project A CX-Supervisor application will consist of one or a number of pages linked together. The pages may contain passive or active graphics, text or animations, and may be grouped together logically to form a project.
Page 160
Microsoft Windows based applications to be started. CX- Supervisor is run from the Taskbar. Text Object In CX-Supervisor, a text object is a string on a page. Attributes such as typeface, point size, embolden, italicise, underline, left justify, flush right, and centre can be applied to enhance its presentation.
Page 161
Appendix E Glossary of Terms Wizard Wizards are dialogs used by the CX-Supervisor development environment to take the user through complex operations in a simplified step-by-step process.
Cat. No. W09E-EN-01 The following table lists the changes made to the manual during each revision. The page numbers of a revision refer to the previous version. Revision Date Revised content code Sept. 2010 First version in the standard Omron format.