Table of Contents
System
This object allows you to get informations about the current operating system and execute some actions on it.
Functions
System
Constructor function.
Syntax
var myObject = new System();
Methods
storageLocationPath
Returns the path of a standard storage location.
Syntax
myObject.storageLocationPath(location);
Arguments
- location - (StorageLocation) the storage location
Returns
- (string) the storage location path
storageLocationName
Returns the name of a standard storage location.
Syntax
myObject.storageLocationName(location);
Arguments
- location - (StorageLocation) the storage location
Returns
- (string) the storage location name
openUrl
Uses the default browser to open an URL.
Syntax
myObject.openUrl(url);
Arguments
- url - (string) the URL to open
Returns
- (System) this System
Exceptions
- (OpenUrlError) cannot open the URL
screenCount
Returns the screen count.
Syntax
myObject.screenCount();
Returns
- (integer) the screen count
availableGeometry
Returns the available geometry on a screen.
Syntax
myObject.screenCount();
myObject.screenCount(screen);
Arguments
- screen - (integer) the screen (default: the default screen)
Returns
- (rect) the screen geometry
screenGeometry
Returns the screen geometry.
Syntax
myObject.screenGeometry();
myObject.screenGeometry(screen);
Arguments
- screen - (integer) the screen (default: the default screen)
Returns
- (rect) the screen geometry
primaryScreen
Returns the primary screen index.
Syntax
myObject.primaryScreen();
Returns
- (integer) the primary screen index
isVirtualDesktop
Returns true if the desktop is virtual. A virtual desktop may assemble multiple monitors into one screen.
Syntax
myObject.isVirtualDesktop();
Returns
- (boolean) true if the desktop is virtual
colorDepth
Returns the color depth of a screen.
Syntax
myObject.colorDepth(screen);
Arguments
- screen - (integer) the screen (default: the default screen)
Returns
- (integer) the color depth
displayBrightness
Returns the display brightness of a screen.
Syntax
myObject.displayBrightness(screen);
Arguments
- screen - (integer) the screen (default: the default screen)
Returns
- (integer) the display brightness
currentDirectory
Returns the current directory.
Syntax
myObject.currentDirectory();
Returns
- (string) the current directory
username
Returns the user name.
Syntax
myObject.username();
Returns
- (string) the user name
variable
Returns the value of an environment variable.
Syntax
myObject.variable(name);
Arguments
- name - (string) the name of the environment variable
Returns
- (string) the value of the environment variable
timestamp
Returns the current Unix timestamp.
Syntax
myObject.timestamp();
Returns
- (integer) the current Unix timestamp
osName
Returns the operating system name.
Syntax
myObject.osName();
Returns
- (string) the operating system name
Notes
This method should return "GNU/Linux" or "Windows".
version
Returns the operating system version.
Syntax
myObject.version();
Returns
- (string) the operating system version
countryCode
Returns the current country code.
Syntax
myObject.countryCode();
Returns
- (string) the current country code
language
Returns the current language.
Syntax
myObject.language();
Returns
- (string) the current language
logicalDrives
Returns an array of string representing the logical drives.
Syntax
myObject.logicalDrives();
Returns
- (array) an array of string representing the logical drives
availableDiskSpace
Returns the available disk space on a drive in bytes.
Syntax
myObject.availableDiskSpace(drive);
Arguments
- drive - (string) the drive
Returns
- (integer) the available disk space on a drive in bytes
totalDiskSpace
Returns the total disk space on a drive in bytes.
Syntax
myObject.totalDiskSpace(drive);
Arguments
- drive - (string) the drive
Returns
- (integer) the total disk space on a drive in bytes
driveType
Returns the type of a drive.
Syntax
myObject.driveType(drive);
Arguments
- drive - (string) the drive
Returns
- (DriveType) the drive type
batteryLevel
Returns the battery level.
Syntax
myObject.batteryLevel();
Returns
- (integer) the battery level (percentage)
powerState
Returns the power state.
Syntax
myObject.powerState();
Returns
- (PowerState) the power state
manufacturer
Returns the device's manufacturer name.
Syntax
myObject.manufacturer();
Returns
- (string) the manufacturer name
model
Returns the device's model name.
Syntax
myObject.model();
Returns
- (string) the model name
productName
Returns the device's product name.
Syntax
myObject.productName();
Returns
- (string) the product name
logout
Logouts the current user.
Syntax
myObject.logout();
myObject.logout(force);
Arguments
- force - (boolean) force the logout
Returns
- (System) this System
Exceptions
- (LogoutError) unable to logout
restart
Restarts the computer.
Syntax
myObject.restart();
myObject.restart(force);
Arguments
- force - (boolean) force the restart
Returns
- (System) this System
Exceptions
- (RestartError) unable to restart
shutdown
Stops the computer.
Syntax
myObject.shutdown();
myObject.shutdown(force);
Arguments
- force - (boolean) force the shutdown
Returns
- (System) this System
Exceptions
- (ShutdownError) unable to shutdown
suspend
Suspends the computer.
Syntax
myObject.suspend();
myObject.suspend(force);
Arguments
- force - (boolean) force the suspend
Returns
- (System) this System
Exceptions
- (SuspendError) unable to suspend
hibernate
Hibernates the computer.
Syntax
myObject.hibernate();
myObject.hibernate(force);
Arguments
- force - (boolean) force the hibernation
Returns
- (System) this System
Exceptions
- (HibernateError) unable to hibernate
lockScreen
Locks the screen.
Syntax
myObject.lockScreen();
Returns
- (System) this System
Exceptions
- (LockScreenError) unable to lock the screen
startScreenSaver
Starts the screen saver.
Syntax
myObject.startScreenSaver();
Returns
- (System) this System
Exceptions
- (StartScreenSaverError) unable to start the screen saver
Enumerations
DriveType
A drive type.
Values
- UnknownDrive: an unknown drive
- InternalDrive: an internal drive
- RemovableDrive: a removable drive
- RemoteDrive: a remote drive
- CdromDrive: a cdrom drive
PowerState
A power state.
Values
- UnknownState: unknown state
- BatteryPower: on battery power
- WallPower: on wall power
- WallPowerChargingBattery: on wall power, charging the battery
StorageLocation
A standard storage location.
Values
- Desktop: the desktop
- Documents: the documents folder
- Fonts: the fonts folder
- Applications: the applications folder
- Music: the music folder
- Movies: the movies folder
- Pictures: the pictures folder
- Temp: the temporary files folder
- Home: the home folder
- Data: the data folder
- Cache: the cache folder