View Single Post
Old 01-06-2020, 02:25 PM   #883
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,219
Default

It is also crucial to check the timestamp of the message, which will tell you if the message is new, so that you pass each message through only once:
Code:
local WML_intercept = reaper.JS_WindowMessage_Intercept(track_window, "WM_LBUTTONDOWN", false)
prevTime = 0 -- or script start time

function pass_thru()
    pOK, pass, time, wLow, wHigh, lLow, lHigh = reaper.JS_WindowMessage_Peek(track_window, "WM_LBUTTONDOWN")
    if pOK and time > prevTime then
        prevTime = time       
        reaper.JS_WindowMessage_Post(track_window, "WM_LBUTTONDOWN", wLow, wHigh, lLow, lHigh)
    end
end

function Main()
if not mouse.Ctrl() and not mouse.Shift() and mouse.l_down then
            pass_thru()
         end
end
juliansader is offline   Reply With Quote