Right-Clicking Objects Using Device Replay

The function below uses the DeviceReplay object to perform a right-click operation on any object by retrieving the coordinates of the object.

Sub RightClickObj(Obj, Offset_x, Offset_y)
	x_coord = Obj.GetROProperty("abs_x")
	y_coord = Obj.GetROProperty("abs_y")
	Set dr = CreateObject("Mercury.DeviceReplay")
	dr.MouseClick x_coord + Offset_x, y_coord + Offset_y, 2
End Sub