Share this page

# lr.get_attrib_string

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

## JavaScript

    function lr.get_attrib_string(  parameter  )

## VBScript

    Function lr.get_attrib_string(  parameter  )

Command Line Parsing Functions

## Arguments

Name | Comments
--- | ---
argument | The name of a command line argument whose value is a string.

The lr.get_attrib_string function returns the value of an argument that was passed to the run of the script. You place the argument name in the function's argument field and lr.get_attrib_string returns the string values associated with that argument. For example, lr.get_attrib_string("ipv6") returns the IPv6 address of the current Vuser.

## Return Values

Returns the value of the command line parameter as a string. If the parameter is empty (for example a flag), returns an empty string. If the parameter does not exist, returns NULL.

## Parameterization

Standard parameterization is not available for this function.

## VBScript Example

In the following example, lr.get_attrib_double, lr.get_attrib_long, and lr.get_attrib_string retrieve the values of the command line arguments from this command:

Copy code

    Public Function Init() As Long
    Dim wait_time as Double
    Dim secInYear as Long
    Dim mrsCollins as String
    Dim i, loops as Integer
    loops = 3
    wait_time = lr.get_attrib_double("time")
    secInYear = lr.get_attrib_long("secondsInYear")
    mrsCollins = lr.get_attrib_string("MrsCollins")
    ' If the commands succeeded, output the values
    if (wait_time <= 0 )then
        lr.message "Illegal time value = " + Cstr(wait_time)
        Init = lr.PASS
        Exit Function
    else
        lr.message "Wait time value =" + Cstr(wait_time)
        lr.message "The number of seconds in a year is" + Cstr(secInYear)
        lr.message "Mr.Collins' wife is named" + mrsCollins + "Lucas"
    end if

    ' Use the time from the command line

    for i = 0 To(loops - 1)

    ' Your business process or test goes here
        lr.message "Time and date:" + Cstr(Time)
        lr.think_time(wait_time)
        next i

    lr.message "Time and date:" + Cstr(Time) ' FormatDateTime(Time)
    Init = lr.PASS

    End Function

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