Key Press and Key Release in One Action – Ends Early When Mouse Button Is Released

Hi there,

I'm trying to make an action that goes:

step1: Hold C - Press G
step2: Left click mouse and drag
step3: release mouse
step4: Release C - Press G

Unfortunately, when I release the mouse button, it seems to trigger step 4 while I'm still holding C.

I've tried to do this with separate actions and also with one macro using the macro linked here:

I'm on an m1 macbook pro with a generic bluetooth mouse if it makes a difference.

Here is my modified version of the link above.

resolve snap.kmmacros (7.2 KB)

Here is my attempt with two seperate macros:

resolve Macros.kmmacros (3.9 KB)

Since I don't have DaVinci Resolve, I tried it (your second solution) on another app (Safari), and it worked fine. It did not fail in the way you described it. Perhaps you should try that test to confirm my observation. Try it on a few apps. If so, that suggests that DaVinci Resolve has something to do with the problem.

My initial (and very tenuous) guess is that DaVinci Resolve is telling macOS to clear keyboard and mouse buffers, causing macOS to force a release of the C key. I'm not sure if KM can work around that feature, but perhaps. If the problem is with DaVinci Resolve's handling of input buffers, (which is just my working theory) then it could be very tricky to make a workaround.

Is this macro your final goal, or is this just a test to get something else, something more advanced, working? Do you care to elaborate on why you are doing this? You don't have to, but half the time explaining the real goal can help get a better solution.

Hi Sleepy,

You're right, it is davinci resolve, unfortunately. I tried it in Chrome and a text editor and it seems to be working as expected.

What I'm wanting to do is set up "snap" as a modifier key. Basically, I only want it to be turned on when a key is pressed and off any other time.

By default, Resolve forces you to turn it on when you need it and off when you don't.

I found the words "DaVinci Resolve" in your macro... that's how I knew.

Your test with Chrome and an editor confirm what I had found... that your macro works in any program except DvR. That may mean that my guess about DvR clearing the buffer might be right.

Since I don't own DvR, I don't know what snapping means. Let me take another guess... can you use a Mac keyboard modifier key (like CONTROL) instead of the G key as a modifier key? Also, if you do it that way, you can probably get KM itself to press and hold the G key which might give you the result that you want. This might be a solution for you. I'm not at all sure, though.

Yup, it would exactly like if someone held control or shift to select multiple files. Just in this case it would turn snap on when pressed and off when released.

I'll try your idea :slight_smile:

Very good. I would estimate that 50% of all questions are from people trying to solve a problem one way, when the best way to ask the question would have been to state the original problem rather than the current implementation issue. But in this case, it's not clear that my idea will solve your problem.

I tried your idea and, it got better, but resolve is still acting odd.

I played around with some of the marcos settings and found a setup that works 9 times out of 10.

I think the main thing was setting "C is down" instead of "C is pressed".

resolve snap v2.kmmacros (7.6 KB)

Isn't there a famous song from a rock group that says,

Now don't be sad, cause 9 out of 10 ain't bad.

Quite often when you get something that works 90% of the time it tends to be possible that the remaining 10% is caused by a timing issue. Typically you can solve timing issues by adding pause statements between certain KM actions. Once it works 100% of the time, you reduce or eliminate the pause statements until it still works, but just barely. Then you increase the pause statements again a little bit as a buffer.

Once again, my advice is based on instinct (and a little experience) here.

It might help adding in an extra "Pause Until Key is Up" at this point in your Macro?

NB - not tested but just a hunch. If Keyboard Maestro Macros work sometimes but not every time it is very often to do with pauses to let the System catch up.