Share this page

# lr.get_attrib_string

Returns a string type value of an argument passed to the script run.

    String lr.get_attrib_string( String argument_name  );

Command Line Parsing Functions | Java Syntax

## Arguments

Name | Comments
--- | ---
argument_name | The name of a script invocation argument.

The lr.get_attrib_string function returns the value of an argument that was passed to the run of the script. For example, lr.get_attrib_string("ipv6") returns the IPv6 address of the current Vuser.

To view the arguments passed to a script run, see mdrv_cmd.txt in the script folder.

## Return Values

The function returns the value of the argument as a string. If the argument is empty (for example a flag), an empty string is returned. If the argument does not exist, NULL is returned.

## Parameterization

You cannot use standard parameterization for any arguments in this function.

## Example

In the following example, lr.get_attrib_string retrieves the name of the host parameter from the command line string

    test1   -host sun2   -loop 4   -time 1.5

where test1 is the name of the executable and host, loop and time are command line options. lr.get_attrib_string assigns the value to a variable, server. This variable is incorporated into the script and indicates with which server to connect.

        String server;
        String user = USERNAME;
        String password = PASSWORD;
        ...
        server=lr.get_attrib_string("host");
        if (server==null){
            lr.message("Failed to login. Unknown host.\n");
            return 0;
        }

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: