global class

The global class is the root object in Javascript. More...

The REPORTER JavaScript API provides many class constants, properties and methods. For Arup to be able to extend and enhance the API in the future any constant, property or method names beginning with a lowercase or uppercase letter are reserved.
If you need to add your own properties or methods to one of the existing classes then to avoid any potential future conflict you should ensure that the name begins with either an underscore (_) or a dollar sign ($) or the name is prefixed with your own unique identifier.
For example if company 'ABC' need to add a property called 'example' then to avoid any potential future conflict use one of:

Class functions

global properties

Name Type Description
reporter Reporter This property is deprecated in version 12.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.
  [deprecated]

Detailed Description

When Reporter is started a single global class object is created. All of the standard JavaScript functions and properties are available from it.
In addition an instance of a Reporter class is available, from the global reporter property. The reporter object allows you to access the properties and templates used in Reporter.

Details of functions

Batch() [static]

Description

This method can be used to test whether REPORTER is running in batch mode or not.

Arguments

No arguments

Returns

true/false

Return type

Boolean

Example

To check if REPORTER is running in batch mode

if (Batch()) { do something }


Debug(string[Any valid javascript type]) [static]

Description

Print a string to log file for debugging. Anything that you call the debug method on will be 'printed' to the log file window. Note that a carriage return will automatically be added.

Arguments

  • string (Any valid javascript type)

    The string/item that you want to debug

    Returns

    No return value

    Example

    To print string "Hello, world!" to the debug log file

    Debug("Hello, world!");


    Exit() [static]

    Description

    Stop execution and exit from script

    Arguments

    No arguments

    Returns

    No return value

    Example

    Exit from script with

    Exit();


    GetCurrentDirectory() [static]

    Description

    Return the current working directory for REPORTER.

    Arguments

    No arguments

    Returns

    string

    Return type

    String

    Example

    To return the current directory

    var dir = GetCurrentDirectory();


    LogError(message[Any valid javascript type]) [static]

    Description

    Print an error to log file. Anything that you print will be output to the log file window in bold red text. Note that a carriage return will automatically be added.

    Arguments

  • message (Any valid javascript type)

    The string/item that you want to print

    Returns

    No return value

    Example

    To give error "Error: something has gone wrong" to the log file

    LogError("Error: something has gone wrong");


    LogPrint(message[Any valid javascript type]) [static]

    Description

    Print a string to log file. Anything that you print will be output to the log file window. Note that a carriage return will automatically be added.

    Arguments

  • message (Any valid javascript type)

    The string/item that you want to print

    Returns

    No return value

    Example

    To print string "Hello, world!" to the log file

    LogPrint("Hello, world!");


    LogWarning(message[Any valid javascript type]) [static]

    Description

    Print a warning to log file. Anything that you print will be output to the log file window in red text. Note that a carriage return will automatically be added.

    Arguments

  • message (Any valid javascript type)

    The string/item that you want to print

    Returns

    No return value

    Example

    To give warning "Warning: something has gone wrong" to the log file

    LogWarning("Warning: something has gone wrong");


    Output(string[Any valid javascript type]) [static]

    Description

    Output a string from a script. Note that a carriage return is not automatically added.

    Arguments

  • string (Any valid javascript type)

    The string/item that you want to print

    Returns

    No return value

    Example

    To output string "Hello, world!" with a carriage return:

    Output("Hello, world!\n");


    SetCurrentDirectory(directory[string]) [static]

    Description

    Set the current working directory for REPORTER.

    Arguments

  • directory (string)

    The directory that you want to change to

    Returns

    true if successful, false if not

    Return type

    Boolean

    Example

    To set the current directory to C:\temp

    var status = SetCurrentDirectory("C:\\temp");


    System(string[Any valid javascript type]) [static]

    Description

    Do a system command outside REPORTER.

    Arguments

  • string (Any valid javascript type)

    The system command that you want to do

    Returns

    integer (probably zero if command successful but is implementation-dependant)

    Return type

    Number

    Example

    To make the directory "example"

    System("mkdir example");


    Unix() [static]

    Description

    Test whether script is running on a Unix/Linux operating system. See also Windows()

    Arguments

    No arguments

    Returns

    true if Unix/Linux, false if not

    Return type

    Boolean

    Example

    To test if the OS is Unix

    if ( Unix() )


    Windows() [static]

    Description

    Test whether script is running on a Windows operating system. See also Unix()

    Arguments

    No arguments

    Returns

    true if Windows, false if not

    Return type

    Boolean

    Example

    To test if the OS is Windows

    if ( Windows() )


    debug() [static]  [deprecated]

    This function is deprecated in version 12.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.

    Description

    Please use Debug() instead

    Arguments

    No arguments

    Returns

    No return value


    exit() [static]  [deprecated]

    This function is deprecated in version 12.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.

    Description

    Please use Exit() instead

    Arguments

    No arguments

    Returns

    No return value


    output() [static]  [deprecated]

    This function is deprecated in version 12.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.

    Description

    Please use Output() instead

    Arguments

    No arguments

    Returns

    No return value