System

From Real Software Documentation

Jump to: navigation, search
Module

The properties of the System module are used to get information about the user’s computer.


Properties
AddressBook Keyscript NetworkInterfaceCount
CommandLine MouseDown QuickTime
Cursors MouseX SerialPortCount
KeyChainCount MouseY WebCursors
Keychain Network


Methods
DebugLog PenButtonPushed
EnvironmentVariable PenPressure
Gestalt PenType
GetNetworkInterface Pixel
IsFunctionAvailable SerialPort
Log


Class Constants

PenType

The following class constants can be used with the PenType method to determine the type of pen in use with an attached graphics tablet.

Class Constant Description
PenTypeNone No pen.
PenTypeTip The tip end of the pen is in use.
PenTypeEraser The eraser end of the pen is in use.

Notes

MouseX and MouseY return coordinates with respect to the top-left corner of the user's monitor. The Window and Control classes contain MouseX and MouseY properties that are referenced to the window (in the case of the Control class, the control's parent window).

The SerialPort and SerialPortCount properties work normally in carbonized applications running in Mac OS X.


Multiple Interface Support

Multiple network interface support enables you to write applications that can bind to different NIC cards installed on a user's machine. For example, you can use this to write tunneling applications. To see what interfaces are installed on the user's machine, you can use the GetNetworkInterface method and assign the obtained interface object to a NetworkInterface property of the SocketCore class.


Examples

The following displays the number of serial ports on the user's machine and their names. On a 'normal' Macintosh, serialport zero is the Modem port and serialport 1 is the Printer port:

TextField1.text=Str(System.serialportcount)
TextFiedl2.text=System.serialport(0).Name
TextField3.text=System.serialport(1).Name


The following returns the version of QuickTime installed on the user’s computer:

Dim s as String
Dim b as Boolean
Dim i,resp as Integer
#If TargetMacOS
b=System.gestalt("qtim",resp)
If b then
s=Hex(resp)
For i =Len(s) DownTo 1
s=Left(s,i)+"."+Mid(s,i+1)
Next
MsgBox "QuickTime version "+s
End if
#Endif

The result is shown below.

This example checks whether the application is running on Mac OS X 10.5 or higher.

//check the system version

Dim SysVersion as Integer
If System.Gestalt("sysv", sysVersion) and sysVersion >=&h 1050 then
//do something here
End if

The following gets the system environment variables for any supported platform.

Dim sh as New Shell
Dim cmd as String
#If TargetWin32
cmd = "set"
#Else
cmd = "env"
#EndIf


sh.Execute cmd
MsgBox sh.Result


This example gets the value of the COMPUTERNAME environment variable on Windows.

#If TargetWin32
TextField1.Text=System.EnvironmentVariable("COMPUTERNAME")
#EndIf

See Also

Application, MouseCursor, SerialPort classes; App, Cursors, NetworkInterface objects.

Personal tools