'UI_object : The object on UI which you want to right click the mouse.
'Menu_index : the menu's index, which one you want to select
Function RightMouseAction( UI_object, Menu_index)
Set obj = CreateObject("Mercury.DeviceReplay")
Set WshShell = CreateObject("WScript.Shell")
'Get the absolute coordinates of the ibject
absx = UI_object.QueryValue("abs_x")
absy = UI_object.QueryValue("abs_y")
obj.MouseClick absx+3, absy+3, 2
'Optional wait statement
wait(2)
'Menu_index = 4
For i = 1 To Menu_index
WshShell.sendkeys "{DOWN}"
wait(1)
Next
WshShell.sendkeys "{ENTER}"
Set WshSEll = nothing
Set obj = nothing
End Function