Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.IbmHosts Library / Attachmate.Reflection.Objects.Emulation.IbmHosts Library / KeyboardMapper Object / SaveAs Method
The path to the new keyboard map.
Example
In This Topic
    SaveAs Method (KeyboardMapper)
    In This Topic
    Saves the current keyboard map contents to a file.
    Syntax
    expression.SaveAs( _
       ByVal pathName As String _
    ) 
    where expression is a variable that represents a KeyboardMapper Object

    Parameters

    pathName
    The path to the new keyboard map.
    Example
    This example adds a key combination that runs a macro to a keyboard map and saves it in a new keyboard map.
    Public Sub MapKeyToMacro()
        Dim kbmapping As KeyboardMapping
        Dim sequence As InputMapActionSequence
        Dim action As InputMapAction
        Dim path As String
        Dim isKeyInMap As Boolean
        
        Dim key, altKey As Keys
        
        'Define two key combinations in case the first key combination is mapped
        key = Keys_Control + Keys_B
        altKey = Keys_Control + Keys_D
        
        'Se the file path and name for the new keyboard map
        path = Environ$("USERPROFILE") & "\Documents\Micro Focus\Reflection\Keyboard Maps\" & "myKeyboardMap.xkb"
     
        Set kbmapping = New KeyboardMapping
        Set sequence = New InputMapActionSequence
                             
        'Set up the action to run a recorded macro named Test in a module named Module1
        Set action = New InputMapAction
        action.ActionId = InputMapActionID_RunMacroAction
        action.AddParameter "Module1.Test" 'This is the name of the module the macro is in and the macro name
        action.AddParameterAsInteger MacroEnumerationOption.MacroEnumerationOption_Document 'Look for the macro in this Session project
        action.AddParameterAsBoolean False 'Don't ask for any input at runtime
        sequence.Add action 'Add the action to the action sequence
        
        'If the key combination is in the map, use the alternate
        isKeyInMap = ThisIbmTerminal.KeyboardMapper.contains(key)
        If isKeyInMap = True Then
            Debug.Print "in map"
            key = altKey
        End If
        
        'Assign the key combination to the new action
        kbmapping.key = key
     
        'Map the key assigned  to the keyboard mapping to the sequence
        Set kbmapping.mapping = sequence
     
        'Add the new mapping to the session keyboard map
        ThisIbmTerminal.KeyboardMapper.AddMapping kbmapping
        
        'Save the new file
        ThisIbmTerminal.KeyboardMapper.SaveAs (path)
                              
    End Sub
    See Also