<?xml version="1.0" encoding="windows-1252"?>

<!DOCTYPE MyCommands SYSTEM "http://www.nuance.com/NaturallySpeaking/Support/MyCommands/MyCmds11.dtd">

<MyCommands version="2.0" language="0x809">

	<Commands type="global">

		<Command name="add mouse position command" group="LA_Global" enabled="true" states="">
			<description></description>
			<contents type="SCRIPT">
<![CDATA[' Please note there is no error handling and you may have to adjust the wait times
' at the end of the script when using SendKeys command
Option Explicit
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Type POINTAPI
x As Long
y As Long
End Type
' declare Win32 API functions
Declare Function GetCursorPos Lib "user32" _
Alias "GetCursorPos" (lpPoint As POINTAPI) As Long
Declare Function GetWindowRect Lib "user32" _
Alias "GetWindowRect" (ByVal hwnd As Long, _
lpRect As RECT) As Long
Declare Function GetForegroundWindow& Lib "user32" ()
Function GetWinCurPos(hwnd As Long) As POINTAPI
Dim pt As POINTAPI
Dim wRect As RECT
Dim result As POINTAPI
Dim EngineControl As DgnEngineControl
GetCursorPos pt
GetWindowRect hwnd, wRect
result.x = pt.x - wRect.Left
result.y = pt.y - wRect.Top
GetWinCurPos = result
End Function
Sub Main
Dim hwnd As Long
Dim result As POINTAPI
Dim clip As String
hwnd = GetForegroundWindow
result = GetWinCurPos(hwnd)
clip = "SetMousePosition 1," & result.x & _
"," & result.y
' you may have to adjust the wait times below
EngineControl.DlgShow(dgndlgNewCommandWizard, 0, , 0)
Wait 0.4
SendKeys"%y"
Wait 0.2
SendKeys"{Down 3}{Tab 2}"
Wait 0.2
SendKeys clip
Wait 0.1
SendKeys"~Wait 0.2~ButtonClick 1, 1"
Wait 0.1
SendKeys"%a"
Wait 0.1
SendKeys"%c"
End Sub
]]>
			</contents>
		</Command>

	</Commands>

	<Lists>

	</Lists>

</MyCommands>

