User Tools

Site Tools


en:code:system:system

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

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

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

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

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

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

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

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

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

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

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

  1. drive - (string) the drive

Returns

batteryLevel

Returns the battery level.

Syntax

myObject.batteryLevel();

Returns

  • (integer) the battery level (percentage)

powerState

Returns the power state.

Syntax

myObject.powerState();

Returns

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

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

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

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

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

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

  1. UnknownDrive: an unknown drive
  2. InternalDrive: an internal drive
  3. RemovableDrive: a removable drive
  4. RemoteDrive: a remote drive
  5. CdromDrive: a cdrom drive

PowerState

A power state.

Values

  1. UnknownState: unknown state
  2. BatteryPower: on battery power
  3. WallPower: on wall power
  4. WallPowerChargingBattery: on wall power, charging the battery

StorageLocation

A standard storage location.

Values

  1. Desktop: the desktop
  2. Documents: the documents folder
  3. Fonts: the fonts folder
  4. Applications: the applications folder
  5. Music: the music folder
  6. Movies: the movies folder
  7. Pictures: the pictures folder
  8. Temp: the temporary files folder
  9. Home: the home folder
  10. Data: the data folder
  11. Cache: the cache folder
en/code/system/system.txt · Last modified: 2021/02/13 11:23 by 127.0.0.1