Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Terminal Object / StartTrace Method
Specifies the file to which data is written.
A TraceFileExistsOption that specifies what to do if the file already exists. The default is OpenError.
A TraceFormatOption that specifies what kind of trace to perform. The default is TraceDefault.
Example
In This Topic
    StartTrace Method
    In This Topic
    Starts capturing data coming from the host to a disk file.
    Syntax
    expression.StartTrace( _
       ByVal fileName As String, _
       ByVal fileExistsOption As TraceFileExistsOption, _
       ByVal formatOption As TraceFormatOption _
    ) As ReturnCode
    where expression is a variable that represents a Terminal Object

    Parameters

    fileName
    Specifies the file to which data is written.
    fileExistsOption
    A TraceFileExistsOption that specifies what to do if the file already exists. The default is OpenError.
    formatOption
    A TraceFormatOption that specifies what kind of trace to perform. The default is TraceDefault.

    Return Value

    One of the following ReturnCode enumeration values.

    Member Description
    Cancelled Cancelled.
    Error Error.
    PermissionRequired Permission is required.
    Success Success.
    Timeout Timeout condition.
    Truncated The text is truncated.

    Remarks
    Data being transmitted to the host can also be captured. The captured data includes all escape sequences and control codes, but does not include flow control, such as Xon/Xoff characters. The data is captured in binary format and is not translated in any way.
    Example
    This sample shows how to capture incoming host data and save it to a file.
    Sub Trace()
        Dim rcode As ReturnCode
        Dim fName As String
        fName = Environ$("USERPROFILE") & "\Documents\Micro Focus\Reflection\Logs\r-log.rev"
        rcode = ThisTerminal.StartTrace(fName, TraceFileExistsOption_OverWrite, TraceFormatOption_TraceDefault)
        
        ThisScreen.SendKeys "demo"
        ThisScreen.SendControlKey ControlKeyCode_Enter
        
        rcode = ThisTerminal.StopTrace
    End Sub
    See Also