Script Entourage to rename identity

Greetings, scripters!

I’m doing some further tweaking of the excellent “Entourage Exchange Setup 2.0” script by William Smith, for my particular needs. So far, so good - got it to ask about the full name, set the account name to a static value that we prefer, and so on.

One last thing that I’d love for it to do would be to rename the default “Main Identity” to the full name. We do this as a standard practice, to avoid problems when troubleshooting Entourage and it decides to rewrite a new “Main Identity”.

The dictionary for Entourage seems like you might be able to do this via set current identity to “whatever name”, but Entourage just gives me an error when I try to do that. Also, this seems like it might create a new ID rather than just rename one.

Any ideas? Otherwise, I think the way to do it might be via UI actions.

Thanks in advance for any help!

I don’t use entourage, so I’m not sure, but I would guess that “identity” is not a string. It’s probably an object with many properties… name being one of them. As such I would try something like the following…

set current identity to (get first identity whose name is “whatever name”)

tell application “System Events”
set shortName to name of current user
set fullName to “me,change”
set accname to shortName
end tell

property ExchangeServer : “enter web address”

property LDAPServer : “enter server”

property FreeBusyServer : “enter server”

property domainName : “Domain name”

property WindowsDomain : “windows domain”

set emailAddress to “first.last@” & domainName


– Begin account setup

try

set verifyEmail to display dialog "Please enter first name (.) last name ." default answer emailAddress with icon 2 buttons {"Cancel", "OK"} default button {"OK"}
set emailAddress to text returned of verifyEmail

set verifyfullName to display dialog "Please enter the name you would like to show on your E-mail." default answer fullName with icon 2 buttons {"Cancel", "OK"} default button {"OK"}
set fullName to text returned of verifyfullName

set verifyshortName to display dialog "Please verify your AD user name." default answer shortName with icon 2 buttons {"Cancel", "OK"} default button {"OK"}
set shortName to text returned of verifyshortName

set verifyLdapserver to display dialog "Please verify LDAP server for your location." default answer LDAPServer with icon 2 buttons {"Cancel", "OK"} default button {"OK"}
set LDAPServer to text returned of verifyLdapserver


tell application "Microsoft Entourage"
	activate
	make new Exchange account with properties {name:accname, Exchange ID:shortName, domain:WindowsDomain, full name:fullName, email address:emailAddress, Exchange server:ExchangeServer & emailAddress, LDAP server:LDAPServer, LDAP requires authentication:false, LDAP requires SSL:false, free busy server:FreeBusyServer}
	try
		close window "Entourage Setup Assistant"
	end try
end tell

end try


– End account setup


see if that works for you if not you can change it to prompt you for the name.

I was just revisiting this again. What a bum I am for not having replied to folks suggestions!

The above script suggestion doesn’t ’ seem to have anything that addresses the Identity of the Entourage account, but rather the contents thereof.

I see the Entourage applescript dictonary has a tempting looking entry:

However, it seems designed to change identities to another pre-existing one, rather than create a new one with a specified name. I tried “set current identity to”; but no luck.

I suppose I can always brute force it by a finder folder rename after the Entourage script completes it’s exchange setup.

We are moving away from Entourage to Outlook in the not too distant future in any case - don’t know if Outlook supports much in the way of applescript yet.