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
Browser.getWidth();
int getHeight ()
Returns the screen height.Return value
Height of the screen.Examples
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:
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:
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:
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
alert(Browser.getFiles('my_project/data/launcher'));
icon.png,interface.html,launcher.xml,project.css,project.js,style.css,translations.js,UIMess.js
Last update: 03.07.2017
Помогите сделать статью лучше
Была ли эта статья полезной?
(или выберите слово/фразу и нажмите Ctrl+Enter