Title: Re: Entourage and Applescript
on 4/25/01 10:21 AM, Paul Berkowitz at [EMAIL PROTECTED] wrote:

On 4/25/01 7:02 AM, "John Kinsella" <[EMAIL PROTECTED]> wrote:

>> Hello List!
>>   I'm a new member, so forgive me if this has been asked already.  Is
>> it possible to script the creation of new accounts in Entourage?  I
>> have been able to script a new account, but cannot set any of it's
>> properties (account name, email address, server info, etc.)  If anyone
>> has any ideas I'd love to hear them.
>> thanks!
>> John
>>

>Yes, it is possible. Every single account property is configurable by
>script. It's all in the Entourage dictionary under 'POP account' and 'IMAP
>account' classes. Even advanced SMTP authentication stuff.

>--
>Paul Berkowitz

Paul,
  That much I figured out.  That’s how I got to the point of creating the account.  But I cannot figure out how to actually apply those account properties.  Everything I’ve tried either returns an error or just does nothing.  Any idea how to actually apply those properties?
Here’s what I have so far

Tell application “Microsoft Entourage”
Activate
Make new IMAP account
End tell

This creates the account, but how and where do I give it the properties I want to set.
Thanks!!

Ah, you've never done AppleScript. I see. Your real question is "How do I learn AppleScript?" You can set all its properties "at birth" in a properties record, or you can set a variable (an arbitrary word) to the object you make (the account, here), so you can then have a way to reference it and change its properties from any empty defaults. You don't even have to make a new account – you can change properties of an existing account. But I'll assume you want to make a new one. You can set all its properties you need "at birth", or you can set some afterwards. The value types permitted are given also in the dictionary: 'boolean' in the dictionary means to set it to either true or false. 'string' means ordinary text, which is always put in double quotation marks, and you can ignore the 'Unicode text' or 'international text' requirements and just use ordinary text there too (they are converted automatically by Entourage. Just use the same text for names and email addresses as you would when making an account manually. When setting properties "at birth", you can use a properties record which means property label is followed by a colon and the property's value you want, separated from the next by a comma, and the whole thing in curly braces.  So, for example:

tell application "Microsoft Entourage"
    set theAcct to make new IMAP account with properties {name:"Test", full name:"John Kinsella", email address:"[EMAIL PROTECTED]", SMTP server:"mail.ikensella.com", IMAP server:"mail.ikensella.com", IMAP ID:"john2", password:"secret123", include in send and receive all:true, send secure password:false, default signature type:other, default signature choice:signature "Standard"}
end tell


The properties I left out, such as 'SMTP requires SSL' and 'additional headers' will just have their default values (empty), the same as if you don't set these manually in a new account. You can, as  I said, add properties after the account is in existence (otherwise you don't really need to set a variable as I did – I'm not using it at all, in fact.) So you could add, as an afterthought:

    set  theAcct's SMTP requires authentication  to true
    set theAcct's  SMTP uses account settings  to true

But you might as well include everything you need in the initial properties record, and you can leave out the 'set theAcct to' if you don't need to alter anything later.

The one thing I don't know anything about, and which may or may not be important, is the root folder path of an IMAP account. (I use POP accounts.) I suggest you find out how an existing one works. For example, if the account you're writing from here is an IMAP account, do this:

tell application "Microsoft Entourage"
    get root folder path of IMAP account 1
end tell

(or use the name of the account instead of 1), and use it as a model. You may not even need it: it may be something that comes into existence by itself when you create the account with a name. try just leaving it out of the properties record and see if it works OK. It probably will. For the signature, use 'other' signature choice  as I did (unless you prefer 'none'). When you use 'other', then you need to specify which signature by 'other signature choice'– not the actual content of it, but the name of the signature, such as "Standard", as it is named in your Signatures window.

Is this enough to be getting on with?

Paul,
  I do admit to being a newbie AppleScripter.  I sat down with a co-worker who’s had A LOT of  Applescript experience (he wrote a sciript for the University that sits on every machine that allows a user log “log onto” the mac, pass that info to Dave, which authenticates the user, and then based on their username, mount their personal storage space and webspace, which sit on NT servers.  Since you can’t automatically authenticate to NT from a Mac, at this point, this is the next best thing.  Anyway, I see what we were missing.  Thanks so much for your help!!  This is definitely a great jumping off point for us.

Have a great day!!
John Kinsella
-------------
"The surest way to corrupt a youth is to teach him to hold in higher
regard those who think alike rather than those who think differently."
--Neitzsche

http://www.ikinsella.com

Reply via email to