• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Automatic login
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Automatic login


  • Subject: Automatic login
  • From: Jess McKenzie <email@hidden>
  • Date: Thu, 7 May 2009 22:14:52 +1000

Hi,
I'm trying to write a script that sets the automatic login on a mac to the currently-logged-in user. I have written the script below, and it seems to work... but not always.
If automatic login is already set to another user on that computer, when you run the script it succeeds in changing it to the current user. However, if automatic login is disabled, the script will run with no errors, but it takes no affect on the autologin preference, leaving it as disabled. Does anyone know if i am doing something wrong in my script?

Thanking in advance...


property shortName : ""

try
do shell script "echo $USER"
end try

set shortName to result

display dialog "This application perceives that you are currently logged in as:   " & shortName buttons {"Deny", "Confirm"} cancel button "Deny" default button "Confirm"

try
do shell script "sudo defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser " & shortName with administrator privileges
end try

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Automatic login
      • From: Axel Luttgens <email@hidden>
  • Prev by Date: Re: CURL+FTP scripting
  • Next by Date: Re: Automatic login
  • Previous by thread: Re: Scripting MSWord
  • Next by thread: Re: Automatic login
  • Index(es):
    • Date
    • Thread