Tips   >   Functions   >   Sys Functions

Sys Functions

The sys() functions are great, but getting at the list of them through F1 Help is a bit of a hassle.

This section provides you with documentation, tips, and demos for each of the sys() functions.

Also included are some undocumented sys() functions. See the bottom of the list.

Syntax: sys(number)

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

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

sys(1) Omnis version #

Returns the Omnis version number.

sys(2) Omnis program type

Returns the Omnis program type byte:

sys(3) Company name

The company name entered on installation.

sys(4) Your name

Your name entered on installation.

sys(5) Omnis serial #

The Omnis serial number entered on installation.

sys(9) Pathname separator

Returns the pathname separator for the current platform:

sys(10) Library file pathname

Returns the pathname of the current library file.

You can also use notation: $clib().$pathname

sys(11,..,20) Data file pathnames

Returns the pathname(s) of the current open data file segment(s) (empty if none are open).

sys(21) Print file name

Returns the pathname of the current print file name (empty if not open).

sys(22) Import file name

Returns the pathname of the current import file name (empty if not open).

sys(23) Port name

Returns the current port name (empty if no port open).

sys(24) Report device

Returns the current report device, for example, Printer, Screen, Preview, File (Screen is the default).

sys(30,..,49) Menus installed

Returns the name of the installed user-defined menu(s) starting from the left-most menu (empty if none are installed).

You can also use notation to make a list of all the installed menus.

; Make a list of all the installed menus.
Do $imenus.$makelist($ref().$name) Returns List

sys(50,..,79) Windows open

Returns the name of the open user-defined window(s) starting with the top window (empty if none are open).

You can use notation to make a list of all the open windows.

; Make a list of all the open windows.
Do $iwindows.$makelist($ref().$name,$ref.$title) Returns List

sys(80) Report name

Returns the current report name (empty if no report set).

sys(85) Current method

Returns the name of currently executing method in the form ClassName/MethodName.

Note

You can not pass sys(185) as a square bracket parameter. It will continue to evaluate/change to the next currently executing method. You can't freeze sys(85) and pass it.

The solution I found was to pass $cmethod, receive it as an item reference parameter, and then evaluate the reference. (e.g. prMethod.$class().$name)

sys(86) Event parameters

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.

sys(90) Method Stack

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.

You can use sys(90) at the beginning of a timer object method, to prevent it from interrupting other methods.

; Check if there are any other method running before running the timer method.
If sys(90)>1
   ; Do nothing
Else
   ; Run the timer triggered method/code.
End If

sys(91) Decimal separator

Returns the decimal separator.

sys(92) Thousand separator

Returns the thousand separator

sys(93) Parameter separator

Returns the parameter separator for calculations.

sys(94) Field name separator

Returns the file class field name separator.

sys(122) Web client listener

Returns true if the web client server communications listener started successfully; it returns false if listener startup failed, or has not yet occurred.

sys(185) Current method

Returns the name of currently executing method in the format:

Library name.class name/method name/Line number

Note

You can not pass sys(185) as a square bracket parameter. It will continue to evaluate/change to the next currently executing method. You can't freeze sys(185) and pass it.

sys(190) Classes loaded from disk

Returns the number of times Omnis has loaded a class from disk and added it to the memory class cache. See comments below in sys(191).

sys(191) Classes deleted from memory

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.

sys(192) Method Stack

The sys(192) function 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:

  1. classitem - item reference to the class containing the method.
  2. object - the name of the object containing the method in the class; empty if it is a class method.
  3. method - the name of the method.
  4. line - the line number in the method, of the method line resulting in the method on the previous line running.
  5. linetext - the text for the method line.
  6. 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.
  7. methoditem - item reference to the method.

sys(193) Trace log contents

Returns the contents of the trace log to a list. Available in both runtime and design mode. Useful for debugging runtime problems.

Send to trace log has an option, Diagnostic message. When this option is checked, the message will only be logged if the trace log is set to Log diagnostic messages. See F1 Help for more information.

sys(194) Open Windows

Generates a list of open window in the IDE. The list has columns as follows:

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.

sys(195) Selected Objects

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

sys(196) VCS Build Properties

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

  1. name - the internal name of the library
  2. pathname - the pathname of the library file
  3. vcsbuildersname - the $vcsbuildersname property of the library
  4. vcsbuildnotes - the $vcsbuildnotes property of the library
  5. vcsbuilddate - the $vcsbuilddate property of the library

sys(198) Bind Web Client Port

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.

sys(199) Method Commands List

Returns a list with a row for each method command. The list has two columns:

  1. group - the command group
  2. command - the command name
These are all the Omnis commands. If, End if, Set report name, etc.

sys(204) Notation Methods

Returns a list with a row for each function. The list has three columns:

  1. group - the function group
  2. function - the function name
  3. description - the function description
These are all the functions listed in the F9 Catalog > Functions tab.

sys(205) Byte Ordering

Returns the byte ordering of the hardware. True (1) for big-endian machines, false (0) for little-endian machines.

sys(210) Number of Processors

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).

sys(212) Sort Fields Executing

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

  1. name - the name of the sort field
  2. descending - boolean, true if this field is sorted in descending order
  3. upper - boolean, true if this field is sorting of this field is case-insensitive
  4. subtotals - boolean, true if subtotals are printed when the sort field changes
  5. upper - boolean, true if a new page is started when the sort field changes
(I think this function applies to a report class instance when the report is being printed.)

sys(3000) Trace to file start

The first time you issue a sys(3000) during a session of Omnis Studio, Omnis creates a sequential log file that is named SEQLOG#.TXT, where # is a number. The file is created in the sys(115) directory. Each time you quit and restart Omnis Studio, the next time you issue a sys(3000) Omnis Studio will start a new trace log file. The file name will have the next sequential number appended to it. e.g. SEQLOGO.TXT, SEQLOGO1.TXT, SEQLOGO2.TXT

Omnis Studio then writes the trace log messages to that file.

The first time you issue a sys(3001) during a session of Omnis Studio, Omnis give you an OK message telling you the trace log file name. Subsquent uses of sys(3001) during the same session of Omnis Studio do not trigger the OK message.

The sys(3000) function is very useful thing if you have a procedure that crashes Omnis Studio. By issuing sys(3000) and then running the code which causes Omnis Studio to crash, you can then open the trace log file and get some hints as to when in your methods the crash is occurring.

Warning

If you delete the file with Omnis Studio still open and try to issue a sys(3000), Omnis will inform you that it can't find the file. Only delete the file after you quit Omnis Studio. To clear the trace file, open the file, select and delete all text and then close the file.

Note

The Send to trace log method does not work for sending text to the sys(3000) file trace log.

Click Run Demo in the StudioTips Browser to see how it works.

sys(3001) Trace to file stop

Stop trace to file.

See sys(3000) for more information.

sys(4019) Externals browser

Opens the External components Browser

sys() Loop

Loop through the sys functions. It's interesting what you can find out when you put sys(#) in a loop. :-)

; Loop through all the sys() functions.
For Num from 1 to 5000 step 1
   If len(sys(Num))>0
      Yes/No message Loop through sys() functions (Icon) {////sys([Num]) = [sys(Num)]////////Continue?}
      If flag false
         Break to end of loop
      End If
   End If
End For
Quit method kTrue

Click the Run Demo button in the StudioTips Browser if you want to loop through the all the sys functions. You can click No any time you want to stop the loop.