sys()

Function group Execute on client Platform(s)
General NO All

Syntax

sys(number)

Description

Returns information about the current system depending on a number argument.

Using the sys() function, you can obtain system information such as the current printer name, the pathname of the current library, the screen width or height in pixels, and so on.

You can use the following number values with the sys() function.

Number Description
1 returns the Omnis version number.
2 returns the Omnis program type byte:
bit 0 = full program (value 1),
bit 1 = runtime (value 2),
bit 2 = evaluation (value 4),
bit 3 = integrated (value 8),
bit 4 = Unicode (value 16). Always set.
Note that the current version of Omnis does not support the use of integrated versions.
3 returns your company name entered on installation.
4 returns your name entered on installation.
5 returns your serial number entered on installation.
6 returns the platform code of the current executable:
'W' = Windows 95, 98 or ME,
'N' = Windows NT, 2000, 2003, XP, Vista, Windows 7/8/10
'U' = Linux
'X' = macOS
7 returns a string containing the version number of the current OS. For example, returns "6.2" under Windows 10, and "10.4.8" under macOS 10.4.8
8 returns the platform type of the current Omnis program as a string: 'MAC64', 'WIN32', 'WIN64', 'UNIX'
9 returns the pathname separator for the current platform:
'\' (back slash) for Windows,
'/' (forward slash) for Unix and 64-bit macOS (32-bit Macs will return :)
10 returns the pathname of the current open library file.
11,..,20 returns the pathname(s) of the current open data file segment(s) (empty if none are open).
21 returns the pathname of the current print file name (empty if not open).
22 returns the pathname of the current import file name (empty if not open).
23 returns the current port name (empty if no port open).
24 returns the current report device, for example, Printer, Screen, Preview, File (Screen is the default).
30,..,49 returns the name of the installed user-defined menu(s) starting from the left-most menu (empty if none are installed).
50,..,79 returns the name of the open user-defined window(s) starting with the top window (empty if none are open).
80 returns the current report name (empty if no report set).
81 returns the current search name (empty if no search set).
82 returns the main file name (empty if no main file set).
83 returns the number of records in main file.
85 returns the name of currently executing method in the form class name/method number.
86 returns a list of event parameters for the current event. The first parameter is always pEventCode containing an event code representing the event, for example, evClick for a click on a button: a second or third event parameter may be supplied which tells you more about the event
87 returns horizontal screen resolution in pixels per inch
88 returns vertical screen resolution in pixels per inch
89 returns the text for the current search calculation, or empty if no calculation is set.
90 returns the number of methods on the method stack. This does not work for client requests running in a thread of the Multi-threaded Server.
91 returns the decimal separator
92 returns the thousand separator
93 returns the parameter separator for calculations
94 returns the file class field name separator
101 returns the current printer name, and network path (empty if not connected).
104 returns the screen width in pixels.
105 returns the screen height in pixels.
106

macOS: not relevant - returns a fixed large value.

Other platforms: returns the size in bytes of available physical memory.

107

macOS: not relevant - returns a fixed large value.

Other platforms: returns the total size in bytes of physical memory.

108

macOS: not relevant - returns a fixed large value.

Other platforms: returns a number between 0 and 100 that gives a general idea of current memory utilization, in which 0 indicates no memory use and 100 indicates full memory use.

109

macOS: not relevant - returns zero.

On Windows and Unix returns the unused memory in bytes. This is the number of bytes available in the paging file, added to the number of bytes of available physical memory.

110 Does not return a value using the 64-bit versions of Omnis, and can no longer be relied on as an accurate indicator of the processor type or computer in use.
returns the CPU type. 
For Intel Processors: 
3 = 80386 
4 = 80486 
5 = Pentium 
For PowerMac Processors: 
257 = PowerPC 601 
259 = PowerPC 603 
260 = PowerPC 604 
262 = PowerPC 603e 
263 = PowerPC 603ev 
264 = PowerPC 750 & G3 
265 = PowerPC 604e 
266 = PowerPC 604ev 
268 = G4
313 = G5
111 (macOS only) returns the Apple ROM version: 121 = SI, 124 = IIsi, CI & FX.
114 (macOS only) returns 1 (true) if Apple events are available, 0 otherwise.
115

On all platforms except Windows Vista returns the pathname of the folder containing the Omnis executable, including the terminating path separator.

On Windows Vista returns the pathname of the folder containing the installed writeable files, including the terminating path separator (usually a sub-folder of the AppData Local folder). To get the pathname of the folder containing the Omnis executable, use sys(215).

116 (Unix only) returns 1 (true) if Omnis has been configured to force all file names to be lower case, 0 otherwise.
118 returns additional information about the operating system version; this works under Windows only. 
The information includes major and minor version numbers, a build number, a platform identifier, and information about product suites and the latest Service Pack installed on the system. This function returns the operating system version information in the Windows OSVERSIONINFOEX structure, so you should obtain information about this structure for full details about the information returned (see the Microsoft web site). 
120 (Windows only) returns the width of the current dialog base-width unit based on the current system font; this differs for Small and Large font mode.
121 (Windows only) returns the height of the current dialog base-width unit based on the current system font; this differs for Small and Large font mode.
122 returns true if the Web Client server communications listener started
successfully. It returns false if listener startup failed, or has not yet
occurred.
130 Not supported in Omnis Studio 5.0 and later.
131 Not supported in Omnis Studio 5.0 and later.
132 Not supported in Omnis Studio 5.0 and later.
133 Not supported in Omnis Studio 5.0 and later.
134 Not supported in Omnis Studio 5.0 and later.
135 Not supported in Omnis Studio 5.0 and later.
136 Not supported in Omnis Studio 5.0 and later.
137 Not supported in Omnis Studio 5.0 and later.
138 Not supported in Omnis Studio 5.0 and later.
185 returns the current executing method in the format: 
Libraryname.Classname/Methodname/Linenumber
This is in addition to sys(85) which returns the current executing method in the form Classname/Methodname. 
190 returns the number of times Omnis has loaded a class from disk and added it to the memory class cache.
191

returns the number of times Omnis deleted a memory class cache entry, when it added a class to the cache, meaning that the class deleted from the cache may need to be reloaded

sys(190) and sys(191) provide information you can use to monitor the impact of changing the preference $root.$prefs.$maxcachedclasses. Too low a value for this preference may result in a performance hit, due to too many classes being repeatedly loaded from disk.

192

sys(192) caters for both error handlers and other situations where information about the method stack might be useful. It returns a list representing the current method call stack (with a line for each line that would appear on the debugger stack menu). The first line in the list corresponds to the call to sys(192), and subsequent lines correspond to how the method running the previous line was called.

The list has the following columns:

classitem - item reference to the class containing the method.

object - the name of the object containing the method in the class; empty if it is a class method.

method - the name of the method.

line - the line number of the method line.

linetext - the text for the method line.

params - the parameters passed to the method. This is a two-column list, with columns name and value. The value is the value that would be displayed as a variable tooltip for the parameter.

methoditem - item reference to the method.

inst - item reference to the instance executing the method.

193 returns a list which is a copy of the trace log.
194

returns the list of open windows in the IDE. The list has the following columns:

windowname - the name of the window, as it would appear in the windows menu

classitem - if the window is a class or method editor, the item reference to the class; otherwise null

ismethodeditor - boolean, true if and only if the window is a method editor window

The current line is non-zero if and only if the window is the top design window, i.e. the top class editor or method editor window. When deciding the top design window, the catalog, component store, and property inspector are ignored.

195

returns the list of selected objects, if there is a top design window (as defined by sys(194) above), and if the top design window is a window, report, toolbar, menu, or remote form editor (NOT a method editor). The list has one column:

objectitem - the item reference of the selected object

196

returns the list of all open libraries (including private libraries) and their VCS build properties. The list has the following columns:

name - the internal name of the library

pathname - the pathname of the library file

vcsbuildersname - the $vcsbuildersname property of the library

vcsbuildnotes - the $vcsbuildnotes property of the library

vcsbuilddate - the $vcsbuilddate property of the library

197 returns true (1) if running on Windows XP with themes enabled, false (0) if not.
198 returns an integer which indicates the status of binding the web client server port number to the socket on which the server receives incoming connections. The value is -1 if bind has not been attempted yet, 0 if bind was successful, or a positive value (a socket layer error code) if the bind failed
199 returns a list with a row for each method command. The list has two columns: column 1 is the command group, column 2 is the command name
202 returns the command line parameters passed to Omnis
203 (Win32/Win64 only) returns 1 (true) if Omnis is running as a service
204 returns a list with a row for each function. The list has three columns: column 1 is the function group, column 2 is the function name and column 3 is the function description
205 returns the byte ordering of the hardware. True (1) for big-endian machines, false (0) for little-endian machines.
209 for macOS, returns the pathname of the folder containing the Omnis.app bundle, including the terminating path separator; this may be different to the pathname of the folder containing the Omnis executable (returned by sys(115)) if you are using Omnis as a bundle. For other platforms, returns the same pathname as sys(115).
210 returns the number of processors for the current machine (depending on the information reported by the operating system, the value may not reflect logical processor cores).
212

returns the list of sort fields for the executing method stack. The list has the following columns:

name - the name of the sort field

descending - boolean, true if this field is sorted in descending order

upper - boolean, true if sorting of this field is case-insensitive

subtotals - boolean, true if subtotals are printed when the sort field changes

newpage - boolean, true if a new page is started when the sort field changes

215 Returns the pathname of the folder containing the Omnis executable, including the terminating path separator.
216 Returns the pathname of the currently executing Omnis program.
218 Modifies the OEM character conversion table to leave CR and LF unchanged.
219 Restores the OEM character conversion table to the original mappings for CR and LF.
228 Modifies the OEM character conversion table to leave TAB unchanged.
229 Restores the OEM character conversion table to the original mapping for TAB.
232 (Win32/Win64 only) returns 1 (true) if Omnis is running as an elevated user or administrator
236 Returns true if VCS branching is enabled.

Example

The following example uses sys(6) to test the current OS and branches accordingly.

Calculate lPlatform as sys(6)
If lPlatform='X' ;; on macOS
  Do FileOps.$createdir('/Omnis/Test')
Else If lPlatform='U' ;; on Linux
  Do FileOps.$createdir('/home/omnis/test')
Else ;; on Windows platforms
  Do FileOps.$createdir('c:\Omnis\test')
End If