Script wont update mail account.
Script wont update mail account.
- Subject: Script wont update mail account.
- From: David Siberry <email@hidden>
- Date: Fri, 17 Jun 2005 09:53:33 +0100
Hi below is my script i am developing. I want it to create an e-mail
account, which seems ok. But when the script searches for an existing
e-mail, if the account exists the script is meant to update the fields
of the account.
However the updating does not seem to work, i have stepped through a
debugger and it steps throught the right places and calls the right
methods, it just doesnt seem to update the account. Can anyone help?
Cheers David... See script below..
on setupSMTP()
tell application "Mail"
--SMTP Constants
set cSMTPName to "DSMTP"
set cSMTPAccType to "smtp"
set cSMTPEnabled to 1
set cSMTPUserName to "smtpUserName"
set cSMTPPort to 24
set cSMTPServerName to "smtp.mail.com"
set cSMTPUsesSSL to 1
set cSMTPAuth to "password"
set cSMTPPassword to "pass"
set createIT to true
set p1 to get every smtp server whose server name is equal to cSMTPServerName
repeat with x in p1
set properties of x to {name:cSMTPName, account type:cSMTPAccType,
enabled:cSMTPEnabled, user name:cSMTPUserName, port:cSMTPPort, server
name:cSMTPServerName, uses ssl:cSMTPUsesSSL, authentication:cSMTPAuth,
password:cSMTPPassword}
set createIT to false
end repeat
if (createIT is equal to true) then
set s to make new smtp server with properties {name:cSMTPName,
account type:cSMTPAccType, enabled:cSMTPEnabled, user
name:cSMTPUserName, port:cSMTPPort, server name:cSMTPServerName, uses
ssl:cSMTPUsesSSL, authentication:cSMTPAuth, password:cSMTPPassword}
set properties of s to {name:cSMTPName, account type:cSMTPAccType,
enabled:cSMTPEnabled, user name:cSMTPUserName, port:cSMTPPort, server
name:cSMTPServerName, uses ssl:cSMTPUsesSSL, authentication:cSMTPAuth,
password:cSMTPPassword}
end if
end tell
end setupSMTP
on setupEmail(theAcc)
tell application "Mail"
--Pop constants
set popUN to "David Account"
set popFullName to "David Siberry"
set popServerName to "pop.mail.com"
set popPassword to "password"
set popEmailAddresses to "email@hidden"
set popIncludeWhenGettingNewMail to 1
set popPort to 115
set popEnabled to 1
set popUsesSSL to 0
set popDelayedMsgDelInt to 5
set popDeleteMailOnServer to 1
set popDeleteMsgWhenMovedFromInbox to 1
set popAuthentication to "password"
set popName to "David"
set user name of theAcc to popUN
set full name of theAcc to popFullName
set server name of theAcc to popServerName
set password of theAcc to popPassword
set email addresses of theAcc to popEmailAddresses
set include when getting new mail of theAcc to popIncludeWhenGettingNewMail
set port of theAcc to popPort
set enabled of theAcc to popEnabled
set uses ssl of theAcc to popUsesSSL
set delayed message deletion interval of theAcc to popDelayedMsgDelInt
set delete mail on server of theAcc to popDeleteMailOnServer
set delete messages when moved from inbox of theAcc to
popDeleteMsgWhenMovedFromInbox
set authentication of theAcc to popAuthentication
set name of theAcc to popName
set found to 0
my setupSMTP()
end tell
end setupEmail
on closeDialogue()
tell application "System Events"
tell application process "Mail"
tell window "Welcome to Mail"
click button "Quit"
end tell
quit application
end tell
end tell
end closeDialogue
tell application "Mail"
set found to 0
-- Searches for existing e-mail account whose name is
-- equal to the string declared
set p to get every pop account whose name is "David"
repeat with x in p
-- if account found, then account is edited and
-- values are set to the required defaulted values
my setupEmail(x)
set found to 1
end repeat
if (found is equal to 0) then
-- Create new POP account
set m to make pop account with properties {name:"David", user
name:"David Account", full name:"David Siberry", server
name:"pop.gmail.com", password:"password", email
addresses:"email@hidden", include when getting new mail:1,
port:115, enabled:1, uses ssl:1, authentication:password, delayed
message deletion interval:5, delete mail on server:1, delete messages
when moved from inbox:1}
set p to get every pop account whose name is "David"
repeat with x in p
-- if account found, then account is edited and
-- values are set to the required defaulted values
my setupEmail(x)
end repeat
end if
try
my closeDialogue()
end try
try
quit application
end try
end tell
_______________________________________________
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