Re: Mail issue with new account
Re: Mail issue with new account
- Subject: Re: Mail issue with new account
- From: crooked-eye <email@hidden>
- Date: Wed, 3 Nov 2004 23:50:39 +0000
On 3 Nov 2004, at 04:18, Craig Knelsen wrote:
I'm adding a new account in OS X Mail via an AppleScript studio app. I
have gotten the account and associated smtp server added via
AppleScript (and even the passwords are set after a hack). The problem
is when I go back to view the accounts in Mail: when I attempt to close
the Accounts window, I get a popup window stating that the account I
just added via AppleScript has been changed and asks whether the
changes are to be saved. How can I prevent this popup from happening?
I've looked through the Mail dictionary but nothing jumps out at me.
The "save" command does not work with a Mail account class.
The problem does not appear to occur if I don't set the following
properties when creating the account:
- delete mail on server
- delayed message deletion interval
Has anyone else scripted Mail in a similar fashion?
Hi Craig,
I had a few problems doing something similar last year. The script was
to duplicate my account on another computer but change some of the
preferences (including 'delete mail on server' that I wanted set to
'false')
On 1 Sep 2003, at 08:07, crooked-eye wrote to
email@hidden:
All seems to be working fine until I get to this block:
-- change 'Remove copy from server' account preference to false
tell application "Mail"
tell pop account "crooked-eye"
-- the name of an account in Mail ('pop' seems to be arbitrary)
set delete mail on server to false
end tell
end tell
Although 'delete mail on server' is in the 'pop account' section of
Mail.app dictionary and the script compiles and runs with no errors,
the preference is not changed for the account in Mail.
I received this reply from David Durkee which stopped me banging my
head against the wall (temporarily).
On Monday, September 1, 2003, at 03:19 pm, David Durkee wrote:
What appears to be the equivalent setting in Mail's .plist file isn't
a boolean, which may be a clue. It's called DeletionPolicy, and its
values on three accounts on my machine are set to "AfterInterval",
"RightAway", and "Never". Sounds like the AppleScript property may
have become disconnected from the actual preference and never fixed.
It turns out that the Applescript Mail.app dictionary was (and still
is) out of date. Someone suggested filing a bug report - I didn't.
The Mail.app 1.3.9 Dictionary shows:
delete mail on server boolean -- Indicates whether POP account
deletes messages on the server after downloading
This does not work as a boolean.
I resorted to writing to the .plist file directly. This is the
relevant part of the script. It sets the server deletion policy to
'never' for all the users accounts.
-- If running, stop Mail.app
--Set Deletion Policy in Mail.app to 'Never'
set mailAccts to do shell script "defaults read com.apple.mail
\"MailAccounts\"" as string
set the mailAccts to replace_chars(mailAccts, "DeletionPolicy =
RightAway", "DeletionPolicy = Never")
set the mailAccts to replace_chars(mailAccts, "DeletionPolicy =
AfterInterval", "DeletionPolicy = Never")
do shell script "defaults write com.apple.mail MailAccounts '" &
mailAccts & "'"
-- open Mail app.
--string replacement subroutine from Apple's website
on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars
There is probably a _far_ better way to do this sort of thing.
Best
John Maisey
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden