Global Variables

From STX Wiki
Jump to navigation Jump to search

Global variables are preceded by the character @ and are accessible from all classes and macros. The following global variables are reserved.

Notes: All global variables are used for the program configuration. In order to avoid program malfunction, global variables should not be changed or deleted by the user. Most of these variables are managed by the master shell and stored in the CurrentSetup->Global->Program->Settings section of the Workspace file (default: default.stxws).

@BUILD

The @BUILD variable contains the character encoding build of this executable (Unicode or ASCII).

@DEBUG

The global variable @DEBUG can be used to enable/disable the debug mode. You can activate the debugger at any time with the keyboard combination Ctrl+D.

0 off
1 debug scripts
2 debug all applications
3 debug all except the default application
4 use a dialog to select the debug mode for each application

@LOGMSG

The @LOGMSG variable can be set to 0 (off) or 1 (on). If on, all messages received by the macro GETMESSAGE are logged in the Log window.

@MASTER

On program startup, the id (8 hex digits) of the master shell is stored in the variable @MASTER. This variable can, for example, be used in POSTMESSAGE to send a message to the master shell. Most macros used for communication also accept the keyword MASTER.

@OSVER

The global variable @OSVER is set to the Windows version running on the computer. Possible values are:

0000 the current operating system is unknown
0501 Windows XP
0502 Windows Server 2003
0600 Windows Vista, Windows Server 2008
0601 Windows 7, Windows Server 2008 R2
0602 Windows 8, Windows Server 2012
0603 Windows 8.1, Windows Server 2012 R2

Note that the service pack is not specified here. This information was last changed in STx Version 4.3

@PLAYGAIN

The gain value in decibels to use when playing back wave items. This value is currently used in Waveform & Segmentation Viewer, Spectrogram & Parameters Viewer, Spectrum Viewer and the PlayWave class.

@REPORTRUNTIMEERRORS

The global variable @REPORTRUNTIMEERRORS is set to either 0 (off) or 1 (on). Runtime error reporting is off by default. If turned on, any errors occurring will display a dialog informing the user of the error. This can be very useful for writing bug-free code!

@ROOT

The @ROOT global variable is set to the STx installation path (program directory).

@TEMPDIR

The @TEMPDIR global variable is used to save temporary data. It's location can be chosen by the user. The default value is the value of the Windows environment %TEMP% variable.

@WORK

The @WORK global variable is set to the current working directory selected by the user. By default, this is the same directory as the @ROOT directory.