SYSTEM

Concept Link IconSee also Concept Link IconExample Concept Link IconSpecifics

Read and write the host system time, change the graphic mode and execute some system commands.

Partial WebVue support - See the table with the list of modes below. Not supported modes return an unsuccessful code if used in this context.

The modes SETDATE, SETTIME and SETDATETIME require PcVue to be run with elevated privileges to function correctly - specifically SE_SYSTEMTIME_NAME. From Windows Vista and Server 2008 onwards this privilege is not given by default to a user and should not be given for security reason.

These legacy modes are for compatibility only. We recommend setting up a global clock, and time distribution via a network infrastructure level mechanism such as NTP, SNTP...

Mode

Mnemonic

Syntax

WebVue support

1 SETDATE 1 No
2 SETTIME 2 No
3 GETDATE 3 Yes
4 GETTIME 3 Yes
5 SETREGION 4 No
6 SETSYSREGION 4 No
7 GETREGION 7 No
8 GETSYSREGION 7 No
10 SYSTEM 5 No
11 LOGIN 6 No
12 LOGOUT 7 No
13 SETDATETIME 8 No
14 LANGUAGE 7 Yes
15 USER 9, 10 Yes
16 EXIT 7 No
18 CHANGEPASSWORD 16 No
19 PRINTER 15 No
20 REPAINT 7 No
23 MKDIR 12 No
24 RMDIR 12 No
25 OPERATORMODE 14 No
26 GETDRIVETYPE 13 No
27 GETDISKSIZE 13 No
28 GETDISKFREESPACE 13 No
29 GETDIRECTORYSIZE 13 No
34 LOADCOLORS 17 Yes
35 GETDISKSIZE_EX 18 No
36 GETDISKFREESPACE_EX 18 No

Syntax 1

IntVal = SYSTEM(Mode, Day, Month, Year);

Return type: INTEGER.

Argument

Meaning

Day

The day of the month. Type INTEGER, range 1 to 31.

Month

The month number. Type INTEGER, range 1 to12.

Year

The year number. Type INTEGER, range 1980 to 2099.

Execution

Mode

Mnemonic

Action

1

SETDATE

Modify the internal system date.

Return: 1 if successful, else 0.

Syntax 2

IntVal = SYSTEM(Mode, Hour, Minute, Second);

Return type: INTEGER.

Argument

Meaning

Hour

The number of hours. Type INTEGER, range 0 to 23.

Minute

The number of minutes. Type INTEGER, range 0 to 59.

Second

The number of seconds. Type INTEGER, range 0 to 59.

Execution

Mode

Mnemonic

Action

2

SETTIME

Modify the internal system time.

Return: 1 if successful, else 0

For this to work correctly the computer's time zone must be set to GMT0.

If the instructions SETTIME and SETDATE need to be used together in a function, use mode SETDATETIME instead.

Syntax 3

StrVal= SYSTEM(Mode);

Return type: STR.

Execution

Mode

Mnemonic

Action

3

GETDATE

Return the system date in the format dd/mm/yyyy. If executed in a WebVue session context the date from the computer that hosts the web back end is returned.

4

GETTIME

Return the system time in the format hhmmss. If executed in a WebVue session context the time from the computer that hosts the web back end is returned.

Syntax 4

IntVal = SYSTEM(Mode, Region);

Return type: INTEGER.

Execution

Mode

Mnemonic

Action

5

SETREGION

Select the region that is to be used:

Single screen

1 the default.

Two screens

1 the left screen.
2 the right screen.

Three screens

1 the left screen.
2 the center screen.
3 the right screen.

Four screens

1 the left screen.
2 the left center screen.
3 the right center screen.
4 the right screen.

6

SETSYSREGION

Select the number of regions on the system, by setting Region.

1 A single screen, the default.
2 Two screens, horizontally placed.
3 Three screens, horizontally placed.

   

Return: -1 if unsuccessful.


This instruction is used to inform the software that it is running on a multi-screen system. After it has been used, any windows that are subsequently called will appear in the selected region.

Syntax 5

IntVal = SYSTEM(Mode, Command);

Return type: INTEGER.

Argument

Meaning

Command

A string containing an operating system command (max 255 characters).

Execution

Mode

Mnemonic

Action

10

SYSTEM

The operating system command contained in the string is executed.

This is used for operating system resident commands. It cannot be used for launching other programs.

Return: Always 1, except if executed in a WebVue session context in which case the instruction is not processed and returns 0.

Syntax 6

IntVal = SYSTEM(Mode, Username, Password[, WithPopupBox]);

Return type: INTEGER.

Argument

Meaning

Username

The name of a user known to the system. Type STR.

Password

The password for the above user. Type STR.

WithPopupBox

A flag indicating if a message must be displayed to the user if the login fails. Optional. Type INTEGER.

0 - Do not display a dialog box in case of login failure (default).

1 - Display a dialog box in case of login failure.

Execution

Mode

Mnemonic

Action

11

LOGIN

Log the named user onto the system.

Return: 1 if successful, else 0.

Syntax 7

IntVal = SYSTEM(Mode);

Return type: INTEGER.

Execution

Mode

Mnemonic

Action

7

GETREGION

Return the current region. See Syntax 4 for explanation.

Return: -1 if unsuccessful.

8

GETSYSREGION

Return the current region set-up. See Syntax 4 for explanation.

Return: -1 if unsuccessful.

12

LOGOUT

Log the current user off the system.

Return: 1 if successful, else 0.

14

LANGUAGE

Return the language number of the current session.

Return: 1 or 2 if OK, else 0.

16

EXIT

Shut down PcVue.

Shutdown occurs without further User confirmation unless there are any unsaved changes to the mimics.

Return:

1 if the shutdown is successful.

0 if shutdown is refused. For example,, if a dialog box is open.

20

REPAINT

Refresh the screen.

Return: 1 if successful, else 0.

Syntax 8

IntVal = SYSTEM(Mode, Date, Time);

Return type: INTEGER.

Argument

Meaning

Date

A string in the format DD/MM/YY. Type STR.

Time

A string in the format HHMMSS. Type STR.

Execution

Mode

Mnemonic

Action

13

SETDATETIME

Change the system date and time.

Return: 1 if successful, else 0.

This mode is not available when SYSTEM is used in a Macro animation.

Syntax 9

StrVal = SYSTEM(Mode, Displayname/Firstname/Lastname/Email/Name/Phone/Title);

Return type: STR.

Argument

Meaning

Displayname

Returns the full display name of the user for the current session. Type STR.

Firstname Returns the first name of the user for the current session. Type STR.
Lastname Returns the last name of the user for the current session. Type STR.
Email Returns the email address of the user for the current session. Type STR.
Name Returns the username of the user for the current session. Type STR.
Phone Returns the phone number of the user for the current session. Type STR.
Title Returns the professional title of the user for the current session. Type STR.

Execution

Mode

Mnemonic

Action

15

USER

Returns the name of the user for the current session.

If no user is currently logged in the execution context of this instruction (DefUser), a string containing space is returned.

Syntax 10

IntVal = SYSTEM(Mode, Rights1/Rights2/Rights3/Rights4/Rights5/Rights6/Rights7/Rights8/Rights9/Rights10);

Return type: INTEGER.

For a list of weights for administration, system access, recipe and window printing rights, refer to the topic Access Rights Weighting.

For command, window, alarm acknowledge and layer access, the binary weight corresponds directly to the level. For example, a return of 9 (binary 1001) would correspond to levels 0 and 3.

Argument

Meaning

Rights1

Returns the administration user rights. Type INTEGER.

Rights2 Returns the command user rights. Type INTEGER.
Rights3 Returns the browsing user rights. Type INTEGER.
Rights4 Returns the alarm acknowledgment user rights. Type INTEGER.
Rights5 Returns the alarm masking user rights. Type INTEGER.
Rights6 Returns the alarm maintenance user rights. Type INTEGER.
Rights7 Returns the window user rights. Type INTEGER.
Rights8 Returns the layer access user rights. Type INTEGER.
Rights9 Returns the recipe user rights. Type INTEGER.
Rights10 Returns the Application Architect user rights. Type INTEGER.

Execution

Mode

Mnemonic

Action

15

USER

Return an integer representing the rights of the user for the current session.

The rights are returned as binary weights within the integer.

For more information, see the book User Rights in the help for Configuration of PcVue.

Syntax 12

IntVal = SYSTEM(Mode, Folder);

Return type: INTEGER.

Argument

Meaning

Folder

The name of a folder. For example, "C\\NEWDIR". Type STR.

Execution

Mode

Mnemonic

Action

23

MKDIR

The specified folder is created.

24

RMDIR

The specified folder is deleted.

 

 

Return: 1 if successful, else 0.

Syntax 13

IntVal = SYSTEM(Mode, DiskInfo);

Return type: INTEGER.

Argument

Meaning

DiskInfo

The name of a disk or folder. You must include a colon after the disk name (for example "C:") and two back slashes when specifying a folder (for example "C:\\temp"). Type STR.

Execution

Mode

Mnemonic

Action

26

GETDRIVETYPE

Return the disk type as configured in the BIOS. Return type: INTEGER.

27

GETDISKSIZE

Return the disk size in kilobytes. Return type: LONG.

28

GETDISKFREESPACE

Return the free disk space in kilobytes. Return type: LONG.

29

GETDIRECTORYSIZE

Return the size of the specified folder in kilobytes. Return type: LONG.

 

 

Return: 1 if successful, else 0.

The use of modes GETDISKSIZE and GETDISKFREESPACE is discouraged. The return type LONG no longer accommodate the typical size of a storage space expressed in kilobytes. It is recommended to use modes GETDISKSIZE_EX and GETDISKFREESPACE_EX instead (return type LONGLONG).

Modes GETDISKSIZE and GETDISKFREESPACE are kept for compatibility only.

Syntax 14

IntVal = SYSTEM(Mode, Flag[, Global[, SetSendList]]);

Return type: INTEGER.

Argument

Meaning

Flag

A flag, either 0 or 1:

1 logging is enabled

0 logging is disabled. Default value.

Global

For when Flag is 1:

0 logging is enable only in function where variables are set. (default)

1 global, logging is enable in all SCADA Basic functions. Optional.

SetSendList

0 If Flag = 1 then logging with the current user is done on variables set by the Set/SendList instruction, else no logging takes place.

1 For compatibility, logging without the current user is done on variables set by the Set/SendList instruction independently of Flag's value. Default value is 0 for a new project. Optional.

Execution

Mode

Mnemonic

Action

25

OPERATORMODE

Enables the logging of variables set by a program to be attributed to a user.

Return: 1 if OK, else 0.

The instructions SYSTEM("OPERATORMODE", 0, 0); and SYSTEM("OPERATORMODE", 0, 1); have the same effect: logging is disabled in all SCADA Basic functions.

Syntax 15

IntVal = SYSTEM(Mode, PrinterNb, Enable);

Return type: INTEGER.

Argument

Meaning

PrinterNb Number of a printer for line printing.

Enable

A flag to set the printer spooler status:

0 spooling is enabled.
1 spooling is disabled.

Execution

Mode

Mnemonic

Action

19

PRINTER

Sets the spooler of the line printer PrinterNb in status Enable.

Return: 1 if OK, else 0.

Syntax 16

IntVal = SYSTEM(Mode, UserName, Password , NewPassword);

Return type: INTEGER.

Argument

Meaning

UserName The user account name. Type STR.
Password The current password. Type STR.
NewPassword The password's replacement value. Type STR.

Execution

Mode

Mnemonic

Action

18

CHANGEPASSWORD

Changes the value of a user's password.

 

 

Return: 1 if successful, else 0.

Possible cause of failure are:

  • User name and old password do not match,
  • The new password is empty,
  • The new password is the same as the old one or does not comply with the password strength policy in place.

Syntax 17

IntVal = SYSTEM(Mode, FileName);

Return type: INTEGER.

Argument

Meaning

FileName

The name the color palette file to load. Type STR.

It can include an absolute path or be relative to the project's TP folder.

The file must have the same format as C\Palcol.dat.

Execution

Mode

Mnemonic

Action

34

LOADCOLORS

Loads a new color palette and replaces the current one.

Return: 1 if OK, else 0.

The new color palette is applied to all user sessions.

Syntax 18

LgLgVal = SYSTEM(Mode, DiskInfo[,Unit]);

Return type: LONGLONG.

Argument

Meaning

DiskInfo

The name of a storage space or folder. You must include a colon after a partition name (for example "C:") and double back slashes when specifying a folder (for example "C:\\temp" or "\\\\MyFileServer\\MyFolder"). Type STR.

Unit

The unit you want the return value to be expressed with. Type STR.
Either "B", "KiB", "MiB", "GiB" or "TiB". If omitted, "KiB" is used by default.

Execution

Mode

Mnemonic

Action

35

GETDISKSIZE_EX

Return the size in Unit.

36

GETDISKFREESPACE_EX

Return the free storage space in Unit.

Example

For an example, select the Example link above.