applescript

Discussion in 'Mac Programming' started by sanch212, Nov 28, 2011.

  1. macrumors newbie

    Joined:
    Nov 28, 2011
    #1
    hey every one i have been trying to figure out how to figure out how to write a program that will log a user out of their computer,i suceeded but i want to do it so that it logs them out a specific amount of times and after said times, it finally lets them in. can someone help me by telling me what i should write ?
    :cool:
     
  2. M1LK3Y, Dec 6, 2011
    Last edited by a moderator: Dec 6, 2011

    macrumors newbie

    M1LK3Y

    Joined:
    Dec 4, 2011
    Location:
    Baton Rouge, LA
    #2
    RE:applescript

    Code:
    set logInUser to ”Media"
    set logInPassword to ”media"
    tell application "System Events" to log out
    delay 1
    tell application "System Events"
        keystroke return
    end tell
    delay 2
    tell application "System Events"
        tell application process "loginwindow"
            key code 53
            delay 1
            key code 125
            delay 1
            key code 36 using option down
            delay 1
            keystroke tab
            delay 1
            key code 117
            delay 0.5
            keystroke tab
            delay 0.5
            key code 117
            keystroke return
            delay 1
            keystroke tab
            delay 0.2
            repeat with aChar in characters of logInUser
                keystroke aChar
                delay 0.2
            end repeat
            keystroke tab
            delay 0.5
            repeat with aChar in characters of logInPassword
                keystroke aChar
                delay 0.2
            end repeat
            key code 98 using control down
            delay 0.2
            keystroke return
        end tell
    IMPORTANT: Replace the delay times with how long you'd like each process to be delayed.
     

Share This Page