I would like to automate fast user switching for a set of machines. My current, broken solution is this applescript snippet, adapted from Leopard/SL scripts found online:
set thePassword to "foo"
set N to "1027"
do shell script "/System/Library/CoreServices/Menu\\ Extras/User.menu/Contents/Resources/CGSession -switchToUserID " & N
delay 0.8
tell application "System Events"
keystroke thePassword
delay 1
keystroke return
end tell
The password seems to be entered successfully, but keystroke return
fails to log the user in (the screen "vibrates" to indicate a failed attempt). The funny thing is that pressing the enter key manually does complete the login (hence my assertion that the password is entered successfully)
Any ideas?
Thanks!
tab
out and then press the button for logging in?