Change Full Name script

I am looking for a script that will change the full name to one inputted by the user. The short name does not have to be changed. Ideally I would like a non-GUI solution

Any help would be appreciated :slight_smile:

Hi, joerod;

Not enough info there – what full name?

Adam,

Thanks for the quick response. When you go to System Preferences > Accounts > then select an account, it says “Full Name”. I would like a script to change this based on the users input.

The idea is we have machines that come with a default account I would like the script to start when the user logs in display dialog for the users real name and change default Full Name, I’ve created another script that will prompt to change the password.

I want to keep the default account, just change some settings.

That’s very tricky to do, requires GUI scripting which can be a bit iffy. This script will get the full name of the current user, for example:


-- get the pane open
tell application "System Preferences"
	reveal anchor "passwordPref" of pane id "com.apple.preferences.users"
	activate
end tell
-- unlock it and get the username.
tell application "System Events"
	tell process "System Preferences"
		click button 4 of window 1
		set FN to value of text field 1 of tab group 1 of window 1
	end tell
end tell
FN --> the appropriate full name

To change it, you’d

set the value of text field 1 of tab group 1 of window 1 to NewNameHere

instead of setting FN to what was there.

Thanks Adam this will work perfect with my script! :smiley: