Reflection Desktop VBA Guide
Attachmate.Reflection.Objects Library / Attachmate.Reflection.Objects.Productivity Library / ScreenHistory Object / SaveScreenHistoryFile Method
The full pathname of the file to save the screen history contents to.
If true, overwrites an existing copy of the file. If false, the file will not be saved if it already exists.
Example
SaveScreenHistoryFile Method
Saves screen history contents to the specified file.
Syntax
expression.SaveScreenHistoryFile( _
   ByVal filePath As String, _
   ByVal overwrite As Boolean _
) As ReturnCode
where expression is a variable that represents a ScreenHistory Object

Parameters

filePath
The full pathname of the file to save the screen history contents to.
overwrite
If true, overwrites an existing copy of the file. If false, the file will not be saved if it already exists.

Return Value

One of the following ReturnCode values:
Member Description
Cancelled Cancelled.
Error Error.
PermissionRequired Permission is required.
Success Success.
Timeout Timeout condition.
Truncated The text is truncated.
Remarks
If filePath exists, the file is overwritten.
Example
This example opens screen history after the session connects and saves it to a file after the session is disconnected. To run this example, copy this code to the ThisIbmTerminal code window.
Private Sub IbmTerminal_AfterConnect(ByVal sender As Variant)
 
    'When a session connects, open Screen History
    ThisIbmTerminal.Productivity.ScreenHistory.ScreenHistoryPanelVisible = True
    
End Sub
 
 
Private Sub IbmTerminal_AfterDisconnect(ByVal sender As Variant)
    
    Dim rcode As ReturnCode
    Dim path As String
    Dim timeStamp As String
    
    'Get the current time, remove spaces, and replace invalid filename characters.
    timeStamp = Replace(Time, " ", "")
    timeStamp = Replace(timeStamp, ":", "-")
    
    'Set the file path and name.
    path = Environ("USERPROFILE") & "\Documents\Micro Focus\Reflection\" & timeStamp & "Screens" & ".rshx"
    
    'If a screen history exists, save it to a file.
    If ThisIbmTerminal.Productivity.ScreenHistory.Count > 0 Then
       
        rcode = ThisIbmTerminal.Productivity.ScreenHistory.SaveScreenHistoryFile(path, True)
        
        'Remove the screens from screen history
        ThisIbmTerminal.Productivity.ScreenHistory.ClearAllScreens
    
    End If
    
End Sub
See Also