Switching to macOS Login Window with AppleScript

Since the ‘Other User’ option from the Login Window is not available for network accounts on the Lock Screen of macOS 14, I’m trying to create a workaround.

It seems to be possible to use AppleScript to switch to the Login Window via the user switcher menu. I tried to write a script but didn’t fully succeed yet. The following examples do click and show the user switcher but I have not find out how to actually click the ‘Login Window…’ option then.

#!/usr/bin/osascript

tell application "System Events" to tell process "ControlCenter"
    click menu bar item 3 of menu bar 1
    click its menu bar item "Login Window"
end tell
#!/usr/bin/osascript

tell application "System Events"
    tell its application process "ControlCenter"
        tell its menu bar item 3 of menu bar 1
            click
                tell its menu item 3
                    click
                end tell
        end tell
    end tell
end tell
#!/usr/bin/osascript

tell application "System Events"
    tell its application process "ControlCenter"
        tell its menu bar item 3 of menu bar 1
            click
            tell its window "UserSwitcher"
                tell its group 2
                    set btns to its buttons
                    if name of btn = "Login Window..." then
                        click btn
                    end if
                end tell
            end tell
        end tell
    end tell
end tell
#!/usr/bin/osascript

tell application "System Events" to tell process "ControlCenter"
    click menu bar item 3 of menu bar 1
end tell
do shell script "killall System\\ Events"
delay 0.1
tell application "System Events" to tell process "ControlCenter"
    tell menu bar item 3 of menu bar 1
        click menu item "Login Window..." of menu 2
    end tell
end tell

I hope to find some help on this. Thanks in advance!

  • The Control Center is obviously written in SwiftUI. There are no accessible UI elements

    – 

  • A-ha. So it’s not possible this way?

    – 

Leave a Comment