This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

Available Functions

The following functions are defined for the global object Browser that can be used to customize the logic of the Launcher.

int getWidth ()

Returns the screen width.

Return value

Width of the screen.

Examples

Source code
Browser.getWidth();
					

int getHeight ()

Returns the screen height.

Return value

Height of the screen.

Examples

Source code
Browser.getHeight();
					

string getDirectory ()

Returns the current directory.

Return value

Current directory.

string getPlatform ()

Returns the name of the operating system.

Return value

Name of the operating system.

string getVersion ()

Returns the version of the operating system (only for Windows). The version can take the following values:
  • 50 - Windows 2000
  • 51 - Windows XP
  • 52 - Windows Server 2003 (Windows XP sp2)
  • 60 - Windows Vista
  • 61 - Windows 7
  • 62 - Widows 8
  • 63 - Windows 8.1

Return value

Version of the operating system.

string getArch ()

Returns the operating system bit rate.

Return value

Bit rate.

int getNumAppArguments ()

Returns the number of command-line options that are used to launch the application.

Return value

Width of the screen.

string getAppArgument (int num)

Returns the value of the option by its number.

Arguments

  • int num - Number of the command-line option.

Return value

Option value.

int isArgument (string name)

Returns the value indicating if the option is specified in the arguments section of the launcher.xml file.

Arguments

  • string name - Name of the option.

Return value

1 if the option is specified; otherwise 0.

Examples

The following example checks existance of the magic option in the configuration file launcher.xml:

Source code
if (Browser.isArgument('magic')) {
	alert('The magic option exists.');
}
						

string getArgument (string name)

Returns the value of the option specified in the arguments section of the launcher.xml file.

Arguments

  • string name - Name of the option.

Return value

Option value.

void runProcess (string name, int detached)

Runs the process.

Arguments

  • string name - Path to the process.
  • int detached - 1 to continue instruction execution; 0 to wait for process completion.

int runInformation (string title, string str)

Shows the information dialog box.

Arguments

  • string title - Title of the dialog box.
  • string str - Message text.

Return value

1 if the OK button is clicked; otherwise 0.

Examples

The following example shows the dialog box with the message:

Source code
Browser.runInformation('Message','Hello World!');
						

int runQuestion (string title, string str)

Shows the question dialog box.

Arguments

  • string title - Title of the dialog box.
  • string str - Question.

Return value

1 if the OK button is clicked; otherwise 0.

int runWarning (string title, string str)

Shows the warning dialog box.

Arguments

  • string title - Title of the dialog box.
  • string str - Warning text.

Return value

1 if the OK button is clicked; otherwise 0.

string runOpenFile (string title, string str, string filter)

Shows the open file dialog box.

Arguments

  • string title - Title of the dialog box.
  • string str - Path to the target folder.
  • string filter - File filter.

Return value

Returns the selected file name. If the Cancel button is pressed, returns NULL.

Examples

The following example shows the Open file dialog box, where files in the my_project/data/launcher folder are filtered by using the*.png extension:

Source code
Browser.runOpenFile('Open file','my_project/data/launcher','*.png');
						

string runSaveFile (string title, string str, string filter)

Shows the save file dialog box.

Arguments

  • string title - Title of the dialog box.
  • string str - Path to the target folder.
  • string filter - File filter.

Return value

Returns the selected file name. If the Cancel button is pressed, returns NULL.

string runDirectory (string title, string str, string filter)

Shows the file dialog box.

Arguments

  • string title - Title of the dialog box.
  • string str - Path to the target folder.
  • string filter - File filter.

Return value

Returns the selected directory.

int writeFile (string name, string str)

Writes data to the file.

Arguments

  • string name - Path to the file.
  • string str - Data to write.

Return value

1 if the data is written successfully; otherwise 0.

string readFile (string name)

Reads data from the file.

Arguments

  • string name - Path to the file.

Return value

Data.

string getDirectories (string path)

Returns the list of directories stored at the specified path.

Arguments

  • string path - Path to the target directory.

Return value

Comma-separated names of the directories.

string getFiles (string path)

Returns the list of files stored at the specified path.

Arguments

  • string path - Path to the target directory.

Return value

Comma-separated names of the files.

Examples

Source code
alert(Browser.getFiles('my_project/data/launcher')); 
						
The result is the following:
Output
						icon.png,interface.html,launcher.xml,project.css,project.js,style.css,translations.js,UIMess.js
						
Last update: 03.07.2017
Build: ()