Strange problem with macro run with second user

I have a macro triggered by the hot key command-w that types command-up arrow if Photos is the frontmost app and types command-w otherwise. I have similar macros that work perfectly.

Macro triggered by hot key command-w
If - then - else
If all the following are true: Photos is at the front
Then: Type command-up arrow
Otherwiise: Type command-W

When I’m using Photos, the macro works fine. When not in Photos, the macro doesn’t send command-w two-thirds of the time. This problem occurs when the frontmost app is anything, including Finder. For troubleshooting purposes, I put System Beep before the Type command-W statement. The System beep never plays even when the command-W passes through to the frontmost application and works as expected.

I have quit and relauched Keyboard Maestro: same problem. I logged out and logged in: same problem. I switched to the main user and built the same macro. It works perfectly every time, with or without the System beep.

Any idea why the macro does not work correctly for a second user?

Keyboard Maestro is licensed and installed for only ONE user, but up to 5 Macs for that user.

Even if you bought & installed another copy of KM for the second user, KM is not designed to sync macros among multiple users. You could, perhaps, achieve multl-user sync by having all of the users sync to the same folder of a DropBox account. Of course, if more than one user at a time makes a change to a macro, you would end up with a conflict file in DropBox. Not ideal.

Perhaps @peternlewis will come along and offer some suggestions for multi-user use/sync. Until then, I'd tread carefully, else you might lose data.

Of course, if your other users only USE macros, and don't change them, then this is less likely to be an issue. You could also setup a system whereby you export macros from one account and import into the others.

This is never a recommended approach.

When you simulate a Command-W, it is non-deterministic as to whether that will type a Command-W or trigger the Command-W hot key macro. This what actually happens is:

  • You type Command-W
  • The Hot Key system grabs it and tells Keyboard Maestro
  • Keyboard Maestro triggers the macro:
    • Keyboard Maestro types Command-W
    • The Hot Key system grabs it and tells Keyboard Maestro
    • Keyboard Maestro triggers the macro:
      • Keyboard Maestro types Command-W
      • The Hot Key system grabs it and tells Keyboard Maestro
      • Keyboard Maestro triggers the macro:
        • etc…

Eventually the system gets clogged up enough that the Command-W gets through without the hot key system grabbing it and the cycle is broken.

How long this takes, and whether it happens before everything is aborted is dependent on many factors including the Mac speed and load.

Instead, create a macro group and configure it to be active only in Photos, put your macro in there, and have it unconditionally map Command-W to the arrow key.

I agree with @peternlewis, this will likely cause issues.

Instead of the last "Type command-W", I'd suggest that you use a KM Select or Show a Menu Item action (KM Wiki) to select "Close Window" or "Close Tab", as approparite.

The approach I had of capturing an application’s hot key, checking a condition, and passing the hot key elsewhere has worked for at least half a dozen applications. They must process the keystroke commands faster than Photos. I solved the problem by getting picking the appropriate menu item in Photos.

I already had my macro in a Photos Group, but I don’t know about unconditionally mapping it. I look into that later. Thanks for your help.

When Macintosh users in the know refer to a second (or third or fourth) user, they are NOT referring to second or third or fourth computers. The System Preference item Users & Groups allows you to set up numerous users on your one computer with its one operating system with its one application folder and its one copy of Keyboard Maestro.