2

I have next script on my remote Mac:

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

end run

This script works fine if I run it when I login through VNC (in cmd osascript <script name>), BUT it doesn't work when I run it through ssh. I noticed that only do shell script "/System/Library/CoreServices/Menu\\ Extras/User.menu/Contents/Resources/CGSession -switchToUserID 502" is my problem, another lines work through ssh.

So, I can't use CGSession through ssh on remote Mac?

Rougher
  • 834
  • 5
  • 19
  • 46

0 Answers0