Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Attachmate.Reflection.Objects.Emulation.OpenSystems 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 enumeration 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 on an item in an option list (the "mtest3" option) and saves it to a custom hostpots map.
    'This example creates a hotspot on an item in an option list (the "mtest3" option).
    '    1. mtest1   - Greeting
    '    2. mtest2   - Test2
    '    3. mtest3   - Selective Erase
    'When double-clicked, the hotspot enters "3" on the command line to select that option.
     
    Sub AddHotspotAndCreateHotspotMap()
     
        'Create a new action sequence
        Dim myActionSeq As New InputMapActionSequence
        
        'Add an action to send menu item "3" and add the action to the action sequence
        Dim myAction As New InputMapAction
        myAction.ActionId = InputMapActionID_SendHostTextAction
        myAction.AddParameter "3" & Chr(13)
        myActionSeq.Add myAction
        
        'Add an action to send the Enter control key and add this action to the action sequence
        Dim myAction2 As New InputMapAction
        myAction2.ActionId = InputMapActionID_SendHostKeyAction
        myAction2.AddParameterAsInteger ControlKeyCode_Enter
        myActionSeq.Add myAction2
     
        'Add a new hotspot that is activated by the 'mtest3' string on the screen menu item 3
        Dim myHotSpot As New Hotspot
        myHotSpot.text = "mtest3"
     
        'Add a tooltip for the hotspot
        myHotSpot.Tooltip = "Go to Selective Erase"
             
        'Link the action sequence to the hotspot
        Set myHotSpot.ActionSequence = myActionSeq
     
        'Add the new hotspot to the currently selected hotspots map
        ThisScreen.ScreenHotSpots.AddHotspot myHotSpot
        
        'Make sure Hotspots are enabled and display as buttons
        ThisScreen.ScreenHotSpots.HotSpotsEnabled = True
        ThisScreen.ScreenHotSpots.HotSpotStyle = HotspotStyleOption_Button
        
        'Apply the hotspots
        ThisScreen.ScreenHotSpots.ApplyCurrentHotspots
         
        'At this point you can use the new hotspot in the session -- but it is "in memory" only
        
        'If you are using a custom hotspot map that resides in your user data directory, you can save the current hotspot map using the Save method. This doesn't work if you
        'are using a default hotspot in the programs directory because saving a default hotspot just creates a new file in the user data directory and doesn't reassign it to the session.
        'ThisScreen.ScreenHotSpots.Save
        
        'If you are using a default hotspot, save the current hotspots in a new hotspots map file and assign it to the session as follows:
        Dim newHotspotsMap As String
        newHotspotsMap = Environ("USERPROFILE") & "\Documents\micro focus\reflection\Hotspots Maps\MyCustomHotspotsMap.xhs"
        ThisScreen.ScreenHotSpots.SaveAs (newHotspotsMap)
        
        'Assign the new hotspot map to the session
        ThisScreen.ScreenHotSpots.HotspotsMap = newHotspotsMap
     
    End Sub
    See Also