Switching to another user from the login window ....

Hi,

I can switch from one user to another by script with this line command if the first user is the active user:

do shell script "/System/Library/CoreServices/Menu\\ Extras/User.menu/Contents/Resources/CGSession -switchToUserID " & userID

The line above does not work when the script is executed from a user that is logged out (if the login window is displayed). From the login window, how can I switch to another user by script ?

Thanks in advance.

Robert Lespérance

This uses gui scripting:

on run
	do shell script "/System/Library/CoreServices/Menu\\ Extras/User.menu/Contents/Resources/CGSession -switchToUserID 502"
	delay 5
	tell application "System Events"
		keystroke "password" & return
		delay 4
		keystroke tab
		keystroke return
	end tell
end run