Do macros continue executing after a fast user switch?

I tried to piece together a macro this evening that would do a fast user switch to a different user account, launch an app, then switch back. The macro works to switch accounts, and then it launches the app successfully, but fails to perform the fast user switch BACK to the original account.

I was kinda surprised the macro kept executing once the other account was launched… Could this actually work?

Hey Matt,

In general accounts are not designed to allow another account to switch out of them.

The only thing I can think of would be to ssh into the account and launch an AppleScript or perhaps a Keyboard Maestro macro.

I’d be curious to see how you launched the app in the switched to account.

-Chris

Here's what I put together. Like I said, the Activate Photos step does work, and it works in the account that I just switched to, NOT the account that triggered the macro initially.

When I get home I'll try writing a second macro that can live in the Chris account that switches back to the main account, and try having the first macro trigger the second one.

Ok, so I modified the above to switch into the Chris account at login. BTW, the “at login” trigger isn’t working for me on Sierra, but the same macro executes as expected on 10.11. So on my Sierra machine I have an AppleScript call the macro at login. This works. I switch out of my user, and get the login screen for Chris. The macro is able to insert the password. (Yes yes I know plain text…) That all works.

I then made a new macro in the Chris Account, and an Applescript to run it 30 seconds after login. The macro sucessfully triggers, but the Fast User Switch step fails. In the console it reports:

2017-01-16 17:19:10 Async NSAppleScript error 2017-01-16 17:19:10.231 CompileAppleScript[12458:1709245] Keyboard Maestro Internal AppleScript Execute Error: System Events got an error: Can’t get attribute “AXDescription” of every menu bar item of menu bar 1 of process “SystemUIServer”.

Am I missing something?

Don't know. Let's see the AppleScript.

-Chris

Here's the Applescript:

It runs this macro:

Photos launches as expected, the pause command works, then I get the Applescript error.

Hey Matt,

Sorry. No clue…

-Chris