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 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:
'N' = Windows NT, 2000, 2003, XP, Vista, Windows 7/8/10.
'U' = Linux.
'X' = macOS.
('W' = Windows 95, 98 or ME is no longer used)
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', ‘MACARM’ (Apple M1), '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 (Preview is the default).
30,..,49 returns the name of the installed user-defined fat client menu(s) starting from the left-most menu (empty if none are installed).
50,..,79 returns the name of the open user-defined fat client 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 Deprecated. 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 Deprecated. (macOS only) returns the Apple ROM version: 121 = SI, 124 = IIsi, CI & FX.
114 Deprecated. (macOS only) returns 1 (true) if Apple events are available, 0 otherwise.
115 Returns the pathname of the folder containing the installed writeable files, including the terminating path separator. 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 (Windows only) returns additional information about the operating system version. 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.
123 returns the build number of the Omnis executable. The Omnis About box shows the same build number in the version string
130-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 corresponding 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 executing method.
line - the line number of the executing method line.
linetext - the text for the executing 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.
The "sys192excludesIDEmethods" item in the "defaults" section of config.json, specifies whether or not to include IDE method calls in the list returned from sys(192) (the default is true). This will exclude an IDE method if the library containing the method is marked as always private.
The "sys192ListRowLimit": N item (with N added) in the "defaults" section of config.json allows lists (and rows) with up to N rows to be included as a third column in the output parameter data. If N <= 0 (the default) then no third column is added. If N > 0, then each parameter in the parameter list stored in each line of the sys(192/292) list has a third column, which for lists and rows contains the actual list (or row) data, if the list or row has less than or equal to N lines. In all other cases (not a list or row, or line limit N exceeded) column 3 is empty.
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 Deprecated. Returns true (1) if running on Windows XP with themes enabled, false (0) if not.
198 Returns the Bind status: 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. You can pass parameters to the Omnis executable shortcut e.g. Target value set to "..\..\omnis.exe" "path\to\libto\open" /parameter="myParameter" and retrieve all of those via sys(202).
If the first argument passed via the command line is not a library, you can prepend it with a - (hyphen) character. So when using sys(202), you will get all arguments passed to Omnis, including the first argument, whether it starts with a hyphen or not
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
233 (Windows and Linux only) Returns the title of the main Omnis window
234 Returns a row containing statistics about RESTful requests to the Omnis Server. The row has three columns: column 1 is the count of successful calls, column 2 is the count of calls resulting in an error, column 3 is the count of calls internally requeued because there was not a free user
235 Returns the value of the server configuration item timeOffsetMinutes in config.json. Omnis adds this to the current system date-time when generating the value for #D and #T. timeOffsetMinutes defaults to zero if it is not present in config.json
236 Returns true if VCS branching is enabled.
237 Returns an item reference to the method currently being edited, if the method editor is the top window (and only one method is selected).
238 Returns 1 (true) if the remote debug server is running
239 Returns true if the Startup method in the library has finished, or false if not
240 Returns a string that identifies the current monitor configuration. You could use this in your code to branch according to the monitor configuration of end users
241 Returns a list containing the find and replace log list from $findandreplace. Where possible, the 6th column named ‘item’ contains an item reference either directly to the found data, such as a method line, or to the item containing the found data, such as a property
242 Returns a string which uniquely identifies the current child process when running in the Multi Process Server. If the current process is not a child process, returns 0.
243 Returns true if Omnis is currently running as a Multi Process Server.
250 Returns a list of files which were used to open Omnis, e.g. double-clicked from the Finder, or passed on the command line. This is empty if Omnis was opened directly by double-clicking
251 On Windows, returns the width of the available area of the main application window; the same information is returned in the $mainresized task message.
On macOS, returns the overall width of all screens
252 On Windows, returns the height of the available area of the main application window; the same information is returned in the $mainresized task message.
On macOS, return the overall height of all screens
253 Returns true if Omnis is using dark mode.
254 Returns the pathname of the folder where Omnis writes scripts and other files used to generate PDF documents.
255 Returns the pathname of the folder where Omnis writes temporary PDF files.
256 Returns the maximum server license count.
257 Returns the current number of server licenses in use.
290 Returns the number of methods on the method stack excluding any that are to be cleared. This does not work for client requests running in a thread of the Multi-threaded Server.
292 Returns an empty or single line list containing the same columns as sys(192) where the line represents the calling method; see sys(192)
3000 Turn on logging of method command execution.
3001 Turn off logging of method command execution.
3003 Include method commands executed by IDE tasks in method command logging turned on using sys(3000).
3004 Exclude method commands executed by IDE tasks from method command logging turned on using sys(3000).

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