Entourage does not commit account changes during an Appelscriptexecution, but after

V

Vincent Clerc

I am building an Applescript to get mails from a POP account keeping mails
on server. The script handles differently if run from Applescript itself or
from Entourage script menu. See docu in script below.
I would be interested is some body has found a solution, since I would like
to integrate my script in Entourage menu and in a planned action.
Thanks for any input.

### Sample script --- Begin
(*
Applescript for MS Entourage
This script demonstrate that setting keep Mail On server for a given pop
account
is not committed until end of script if run from Entourage Script menu.
If run from AppelScript Editor, the commit is done immediately.

To run this script you must have a POP account defined and named like
${popAccountToSet}
If run from AppleScript editor, no error, the keepOnServer flag toggles
If run from Entourage script menu, you will get an error. But if you look in
the account menu after script execution, you will notice that the
keepOnServer
flag has changed

V. Clerc Oct. 2005 Max OS X 10.4.2, Entourage 11.1
*)
global scriptName
global popAccountToSet -- pop account to keep mails on server

on initGlobals()
set popAccountToSet to "Bluewin Vincent" -- POP account to toggle
keepOnServer
set scriptName to "tryToSetKeepMailOnServerWithDelay"
end initGlobals

on errorDialog(errMsg, errNumber)
log return & " --> ERROR " & scriptName & return & errMsg & return &
"error number = " & errNumber & return
display dialog scriptName & " ERROR ..." & return & errMsg & return &
"error number = " & errNumber ¬
buttons {"Abort"} default button 1 with icon 0
end errorDialog

on run
try
my initGlobals()
set popAccountFound to false
tell application "Microsoft Entourage"
-- retrouver le compte POP et le modifier
repeat with popAccount in POP accounts
if name of popAccount is popAccountToSet then
set popAccountFound to true
set leavOnServerFlag to leave on server of popAccount
set leave on server of popAccount to not
leavOnServerFlag
log " --> For POP account <" & popAccountToSet & "> keep
on server set to " & (not leavOnServerFlag) & " <-- "
if (leave on server of popAccount) is not (not
leavOnServerFlag) then
error "Could not toggle keep on server flag for
account " & ¬
" <" & popAccountToSet & ">" number 1002
end if
exit repeat
end if
end repeat
end tell
if not popAccountFound then
error "Could not find POP Account " & return & "<" &
popAccountToSet & ¬
">" number 1000
end if
on error errMsg number errNumber
beep 1
my errorDialog(errMsg, errNumber)
end try
end run
### Sample script --- End
 
V

Vincent Clerc

Le 2.10.2005 16:52, dans BF65C0D3.428E%[email protected], « Vincent Clerc »
I am building an Applescript to get mails from a POP account keeping mails
on server. The script handles differently if run from Applescript itself or
from Entourage script menu. See docu in script below.
I would be interested is some body has found a solution, since I would like
to integrate my script in Entourage menu and in a planned action.
Thanks for any input.
I finally found a solution by splitting the job in two scripts and calling
the two scripts in one Entourage action. Hope it helps somebody else.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top