Keyboard Shortcut to Zoom in Incrementally in Preview (Like Trackpad Pinch or Similar)?

It's a relief that the code actually works now. I'm especially glad because I made the code as short as possible by removing a little error detection. I thought that the error detection might be overkill.

The dual audio thing that you heard is a good clue. The reason for that (I think) is that I didn't have you put a Semaphore at the start of the macro to prevent duplicate copies of the macro from running. As a result you probably had two copies running concurrently. Instead of using a semaphore to solve it, another option is to open the debugging window to see (and to kill) and hangover processes that didn't die earlier. A third option is to put timeouts on actions but I don't like that because you can't see the timeouts in the code.

When KM spoke twice, one copy said "1.8 seconds" and the other said "3.4 seconds". Note in that video that we heard 5 or 6 "tink" sound effects so that tell us that two copies were running. If we had timeouts or if you cancelled running macros in the debugger that would resolve the dual voices. But this isn't the cause of your problem per se.

I can see in your video the KM Action for Dragging the mouse takes about 1.5 seconds and your action that tells Preview to Zoom to Selection takes about 1.5 seconds. That's roughly where your 3 seconds is occurring. Maybe now we can address your problem. On my Mac the Mouse Drag takes under one second and the Zoom takes under half a second. Combining them with the 0.1 second pauses, I tend to hear the number "1.5 seconds." Yours appears to be about half speed on each step. That's not good.

But it's worth noting that we can conclude that at least the first of those two values isn't KM's fault because your new program has this line:

The action above means that KM will wait until Zoom to Selection appears (which only exists after the selection is made). And for you that step alone is taking about 1.5 seconds. So it sounds like something is slow with your Preview. So I have to ask you what kind of disk is your file stored on? Is it stored on a slow disk, perhaps a CD? or a USB stick? That might explain the slow speed. You are probably going to say "no," but I have to ask because that could cause this problem. Do you have more than one disk drive? I know it's crazy, but this is the direction I'm leaning on this problem.

I also want to ask you what kind/brand/model of mouse you have. Did you install any software for the mouse or is it just using macOS drivers? I'm not sure if this is a possible cause but I have to ask.

I also want to ask if you tried running this macro on the default monitor. You said you have three monitors. I'm not very familiar with that situation and I'm not sure if that could cause mouse delays in macOS or KM. When you run this latest software all on the same monitor, does it give you 1.5 or 3 seconds total?

I can understand if you want to give up. But I'm persistent. If you want to appeal this to a higher power on these forums, just ask. I suspect that some of the uber-geniuses on this forum are just giving the community a chance to work things out on their own. That's the way it should work. So far my problem solving here has been fairly good, I don't want you to bring down my average. :slight_smile:

I'm leaning in the direction here that the delay is caused by Preview and I'm speculating/guessing that the data is stored on a slower drive or USB stick. Let me know.

Sleepy, thanks! To answer your questions:
The file I tested turned out to be stored on iCloud, but I just moved it to my MacBook Pro internal harddrive, and no change, still over 3 seconds. I use a late 2012 MacBook Pro Retina 13", with flash storage.
The mouse I have connected is a relatively old Microsoft Intellimouse, but when I run the test without mouse, it is still the same.
I have used my internal display to run these tests of yours. Tried external now, still over 3 seconds.

If there is someone here that knows a solution I would gladly take it, since actually I just want to fix it as fast a possible so I can continue my work with more productivity.

I realize how long this has taken. You have been patient. Let's ask one of the experts to chime in.

I was so close with the idea of it being on a different disk. It was on iCloud! I never thought of that.

Experts? You there?

1 Like

I just found this relevant action that actually CAUSES the delay in the mouse drag feature:

At least that's what I think it does. I recommend you experiment with it.

1 Like

The Set Action Delay action can configure the delay after the mouse clicks down and again after the mouse moves. So basically:

  • Click
  • Delay (as configured by the action)
  • Drag mouse
  • Delay (as configured by the action)
  • Release

That's illuminating, and authoritative. I recommend that the original poster try reducing the value. If he's still willing to try things. I did my best to help him, I'm low on ideas.

Thank you for solving this Sleepy, and peternlewis for more information.
I put the delay action into my macro and it is now 1.4 seconds, which is perfect. Really happy this got fixed.

You were very patient to allow a second rate problem solver like me to help.