Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Attachmate.Reflection.Objects.Emulation.OpenSystems Library / HotSpots Object / Save Method
Example
Save Method (HotSpots)
Saves changes to current hotspots map. If the current hotspots map (identified by the HotspotsMap property) resides in the installation directory and cannot be written to, the map is saved to the current user's Hotspots Maps subfolder underneath the Reflection folder, using the terminal session name as the hotspot map filename.
Syntax
expression.Save() As ReturnCode
where expression is a variable that represents a HotSpots Object

Return Value

One of the following ReturnCode enumeration values, unless an exception has been thrown.

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 "mtest2" option) and saves it to a custom hostpots map.
'This example creates a hotspot on an item in an option list (the "mtest2" option) and saves it to a custom hostpots map.
'    1. mtest1   - Greeting
'    2. mtest2   - Test2
'    3. mtest3   - Selective Erase
'When double-clicked, the hotspot enters "2" on the command line to select that option.
 
Sub AddAHotspotToACustomHotSpotsMap()
 
    'Create a new action sequence
    Dim myActionSeq As New InputMapActionSequence
    
    'Add an action to send menu item "2" and add the action to the action sequence
    Dim myAction As New InputMapAction
    myAction.ActionId = InputMapActionID_SendHostTextAction
    myAction.AddParameter "2" & 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 'mtest2' string on the screen menu item 2
    Dim myHotSpot As New Hotspot
    myHotSpot.text = "mtest2"
 
    'Add a tooltip for the hotspot
    myHotSpot.Tooltip = "Go to Test 2"
         
    'Link the action sequence to the hotspot
    Set myHotSpot.ActionSequence = myActionSeq
 
    'Add the new hotspot to the currently selected hotspots
    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