3 Replies Latest reply: Apr 7, 2015 10:03 AM by regnoc
carter.x Level 2 Level 2 (245 points)

I've been using this for some years now with ARD to log into whole labs when we are doing work on them. As you can see below I would use this command to have an entire lab login for me. As of OS X Mavericks it would see you cannot use osascript -e? Can someone help me create a method that works with Mavericks that does the following?

 

osascript -e 'tell application "System Events" to keystroke “xxxxusernamexxxx"'; \

 

osascript -e 'tell application "System Events" to delay 1.0'; \

 

osascript -e 'tell application "System Events" to keystroke return'

 

osascript -e 'tell application "System Events" to delay 4.0'; \

 

osascript -e 'tell application "System Events" to keystroke “xxxxpasswordxxxx"'; \

 

osascript -e 'tell application "System Events" to delay 1.0'; \

osascript -e 'tell application "System Events" to keystroke return’


Thank you!

  • rccharles Level 5 Level 5 (6,300 points)

    Have you verified that you have assistant devices turned on?

     

    Could put all commands in an applescript and then invoke from the command line.

     

    could use unix sleep 1 instead of ... < just thought that I'd comment. >

     

    osascript -e 'tell application "System Events" to delay 1.0'; \

  • FreddyFalcon Level 1 Level 1 (0 points)

    Mavericks doesn't seen to give focus to the username field when booting up. A more sophisticated script could address this, but it would run afoul of the tighter security around access for assistive devices. The simpler solution is to run the command "killall loginwindow" before running osascript. When the loginwindow comes back, focus is on the username field so the osascript commands will work. You typically don't need the delay lines on modern hardware. If using ARD or a similar tool killall loginwindow must be run separately, since nothing coming immediately after it will be processed.

  • regnoc Level 1 Level 1 (0 points)

    run as root

     

    osascript <<EndOfMyScript

    tell application "System Events"

    keystroke "your user"

    delay 5.0

    keystroke return

    delay 1.0

    keystroke "your password"

    keystroke return

    delay 1.0

    keystroke return

    end tell

    EndOfMyScript