My app Mail Archiver uses a lot of AppleScripts via NSAppleScript to get data from Mail or Outlook. I’ve got warnings for Automation access and lots of error handling.
One user got an error when compiling the following script:
with timeout of 10000 seconds
tell application id "com.apple.mail"
set theAccounts to (get name of accounts)
There is, however, no range and no error number.
The Automation part of Security & Privacy doesn’t show anything because he doesn’t even come that far. He has already restarted his computer. I’ve made him an scpt file with the script. And he can’t open the file.
Any idea what could happen here?
Most likely there is no any internet account activated on the user’s Mail.app. The user should:
- Open menu item “Accounts…” of menu “Mail” of Mail.app.
- Window “Internet Accounts” opens. The user should drag the internet accounts from right section of this window to the left section of the same window, to activate them for the Mail.app.
No, that’s not the case here.
I made a new user on my MacBook Air with Monterey. It’s not possible to open Mail without creating an account first. I added one account and made the account inactive. The script still compiled and event got a result.
But the problem is moot anyways because the user didn’t get back to me.
Another reason for your application to fail could be the following:
- User should go to System Preferences → Security & Privacy → Automation
- Find in window that opens your Mail Archiver.app
- In its sub-items, the user should find Mail.app and set (check) the checkbox.
NOTE: If it is checked already for old version of Mail.app, then the user should uncheck it, then check again to activate new setting.
This will allow to your Mail Archiver.app to control Mail.app
No, this can’t be the reason at all. My app handles everything for the user. The target for all scripts is started, then I check the permissions for AppleScript. The scripts are compiled and executed. For errors the user sees an error message. But I can’t really see why a script can’t be compiled that works for me every day.
What say the compile time error… Pay more attention to the NOTE of my previous post as well.
And, how you handle everything for the user? As I know, this is impossible because the user should to confirm manually (when the dialog appear) to control Mail.app with your Mail Archiver.app. That is, manual actions from user is required to get settings properly.
Also, next time, I recommend writing your applications with the ability to work in debug mode (by switching the value of the debugMode boolean variable), because there are users who find it very difficult to describe the problem.