Marcus Tettmar wrote:Naturally this will fire several times as the event is detected several times WHILE the key is down. Perhaps detecting a key going UP is better?
Don't think you can "ripple through".
Thanks. I have modified the code and took the disable out of the click handler. So there is a little delay of 0.2 sec after the tap before disabling. That works!
The rest of the code is there for completeness. But the part of trying to see whether the text carrot is near the tap, is not working yet, please ignore.
Code: Select all
//Set IGNORESPACES to 1 to force script interpreter to ignore spaces.
//If using IGNORESPACES quote strings in {" ... "}
//Let>IGNORESPACES=1
//
Let>WIN_USEHANDLE=0
Let>WF_TYPE=1
Let>WIN_REGEX=0
SetFocus>firefox*
GetCaretPos>textX,textY,0
//
let>disableClick=False
//
onevent>key_down,VK1,0,doMouseClick
label>idle_loop
if>disableClick=True
onevent>key_down,VK1,0,
endif
wait>0.2
goto>idle_loop
//
// SRT called on tap
srt>doMouseClick
**BREAKPOINT**
let>disableClick=True
onevent>key_down,VK1,0,
Let>WIN_USEHANDLE=1
Let>GAW_TYPE=0
GetActiveWindow>activeWn,actWinX,actWinY,actWinW,actWinH
// get tap X,Y and relative to window
getcursorpos>tapX,tapY
let>tapXrel={%tapX%-%actWinX%}
let>tapYrel={%tapY%-%actWinY%}
wait>0.1
**BREAKPOINT**
// get text cursor X,Y and relative to window
GetCaretPos>textX,textY,0
let>textXrel={%textX%-%actWinX%}
let>textYrel={%textY%-%actWinY%}
// test whther not really a text cursor postion (in 100,100 box relative to window)
if>{(%textXrel%>100) or (%textYrel%>100)}
// test whether tap is within text cursor range (Tap max 150,40 from text cursor postion)
if>{(%tapXrel%-%textXrel%<350) and (abs(%tapYrel%-%texYrel%)<100>notepad
'run>%sys_native%\osk.exe
endif
endif
END>doMouseClick