Does anyone have any good ideas how to have user input in a mail rule called script (i.e. that is threaded and has no context for user input)? When I try to do “display dialog” of any type in a script that has
using terms from application "Mail"
on perform mail action with messages theMessages
to allow threading, it crashes both the script and mail!
Is there a way around this while preserving threading? I tried to have other apps display the dialog, by doing a “tell Finder” or such, but it still crashes.
AppleScript is not threaded, so I think the answer to “Is there a way around this…” is very probably no. When a script puts up a UI, it stops cold until the UI is dismissed, which freezes whatever it was trying to do for Mail - to Mail, it’s unresponsive.
If you are just displaying information and not waiting for a response you could use ‘ignoring application responses’. The flow of the script continues once the alert or dialog is displayed.
The only application I could get this to show the dialog in was the Finder though:
tell application "Finder"
activate
ignoring application responses
display alert "Alert message window"
end ignoring
ignoring application responses
display dialog "Alert message window"
end ignoring
end tell