Applescript Help/Request: Run while login window is open to enter password and login

Discussion in 'Mac Programming' started by Knolly, Oct 3, 2008.

  1. Knolly macrumors 6502a

    Jul 22, 2007
    Okay, sounds incredibly insecure, yes?


    But here's my situation...

    I have my Macbook Pro shut and hooked up to my TV which I use to run Plex.

    I basically just want to be able to launch Plex and do everything using nothing but the remote... Using Mira I have the Plex part covered, the only problem is that usually if I switch monitors, when I go over to my TV it'll put me at the login screen... So I'll have to waltz on back to my computer in the other room and blindly type in the password hoping I'm in the right text box.

    Point being... Would it be possible to write an Applescript that securely selected the password box, typed in a password I put into the AppleScript, and then hit enter? I can launch an AppleScript via the remote so it would be excellent.

    To one up it even more if this was possible, would it be possible for me to use one button to run the Applescript and then it would wait for a button combination before putting in the password?

    Many many thanks to anyone that can help make my mini-home/dorm-theater setup that much more automated/awesome.
  2. pulsewidth947 macrumors 65816


    Jan 25, 2005
    Can't you just switch on Auto login? That way you can get it to automatically login in a standard account.

    That way you can always log that user out and log in as a different/admin user should you need to.

    I'd be surprised, and frankly a bit worried, if apple allowed scripts to be run in the background during the login window.
  3. Knolly thread starter macrumors 6502a

    Jul 22, 2007
    Oh that security nonsense...

    As for doing auto-login... Yes, I could but want it to be somewhat secure most of the time. My computer is paired with my remote so I figure if someone has access to both given how stashed away my remote usually is... Hell, kudos to them, haha.
  4. strangervt macrumors newbie

    Nov 18, 2008
    If you haven't found a solution to this yet then try something like this:

    tell application "System Events"
    keystroke "username"
    keystroke tab
    keystroke "password"
    keystroke return
    end tell

    If your system is at the login prompt with the cursor in the username field then this should work.

Share This Page