Hello folks,
I'm running into some issues. This came about because I wanted to disable Mail.app's Junk Mail filtering. We filter at the mail server, so we don't need it, and had issues with some users' mail being deleted after they started tweaking with Mail.app's Junk Mail settings.
I have not been able to determine method to disable this feature via 'defaults write com.apple.mail' so I resorted to scripting the GUI in AppleScript.
I've got a script that does the job, but:
When I set it to run at login, I can't get the script to wait long enough for the user to be fully logged in before it executes. If I add delays in the script, the entire login process seems to wait until the delay elapses before continuing, so that doesn't work.
When I set it to run at logout, I can't get the script to execute quickly enough to do any good. The logout process is so far along that, although the script can launch Mail.app and change the preference via the GUI, the change doesn't actually stick.
I thought, perhaps I could save the script as an applet and deploy it to a known location at login, then have a shell script launch it. But I seem to be running into the same problem. I can understand that you wouldn't want the login process to continue unabated while doing a package deployment, so I get why it's holding things up.
Is there a way to get a GUI script to run at login, and have it behave as it would if it had been added to the Login Items for that user? In other words, prevent its execution until the user was fully logged in.
Thanks for any suggestions!
--
Bryan Vines
bkvines at wgclawfirm.com