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

    Parameters

    pathName
    The path to the new hotspots map file

    Return Value

    One of the following ReturnCode enumerated values.

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

    Exceptions
    ExceptionDescription
    An I/O error occurred while trying to save the hotspots map.
    The caller does not have the required permission to save the hotspots map.
    Example
    This example creates a hotspot for an option list item. It uses the SaveAs method to save the hotspot in a new hotspots map file. When clicked, the hotspot navigates as if the command for the item was entered on the command line.

    To run this sample, create a demo session with the Host name/IP address set to "demo:ibm3270.sim". Then log in with any credentials, enter ISPF on the next screen, and run this code in a code module.
    Sub AddAHotspot()
     
        'Create an action sequence to contain the actions for the hotspot.
        Dim myActionSeq As New InputMapActionSequence
        
        'Create an action to send put the command on the command line
        Dim myAction As New InputMapAction
        myAction.ActionId = InputMapActionID_SendHostTextAction
        myAction.AddParameter "1" & Chr(13)
     
        'Add the action to the action sequence
        myActionSeq.Add myAction
        
        'Create an action to transmit the command to the host
        Dim myAction2 As New InputMapAction
        myAction2.ActionId = InputMapActionID_SendHostKeyAction
        myAction2.AddParameterAsInteger ControlKeyCode_Transmit
        
        'Add the second action to the action sequence
        myActionSeq.Add myAction2
         
        'Create a new hotspot
        Dim BrowseLink As New Attachmate_Reflection_Objects_Emulation_IbmHosts.Hotspot
        BrowseLink.text = "Display source data or output listings" 'This is the text that defines the hotspot.
        BrowseLink.MatchUntilDelimiter = True 'This defines the end of the hotspot as a space.
        BrowseLink.Tooltip = "Display source data" 'This is the tooltip text.
        
        'Configure HotSpots settings to enable hotspots as visible buttons.
        ThisIbmScreen.HotSpots.HotSpotsEnabled = True
        ThisIbmScreen.HotSpots.HotSpotStyle = HotspotStyleOption_Button
        ThisIbmScreen.HotSpots.HotSpotsVisible = True
        
        Set BrowseLink.ActionSequence = myActionSeq
        
        'Check to make sure the hotspot was not already added before you add it.
        If ThisIbmScreen.HotSpots.contains(BrowseLink.text, False) = False Then
        
            Debug.Print "not in at first"
            
            ThisIbmScreen.HotSpots.AddHotspot BrowseLink
        
        End If
        
        'Apply the hotspots to this session.
        ThisIbmScreen.HotSpots.ApplyCurrentHotspots
        
        'At this point, you can use the hotspot but it is saved in memory only and will not be available if you close and reopen the session.
        'To make the persist when you close and reopen the session, you'll need to save it to a hotspots map.
        
        'This saves the new hotspot in the current hotspots map file.
        'ThisIbmScreen.HotSpots.Save
        
        'If you want to create a new hotspots map file, you'll need to save the new file and then assign the new map to the session.
        
        'Save the current hotspots in a new hotspots map file
        Dim newHotspotsMap As String
        newHotspotsMap = Environ("USERPROFILE") & "\Documents\micro focus\reflection\Hotspots Maps\MyCustomHotspotsMap.xhs"
        ThisIbmScreen.HotSpots.SaveAs (newHotspotsMap)
        
        'Assign the new hotspot map to the session
        ThisIbmScreen.HotSpots.HotspotsMap = newHotspotsMap
            
      End Sub
    See Also