From ebdbe4521f631b5640d8c9193c05247a71ab8220 Mon Sep 17 00:00:00 2001 From: Sascha Rommelfangen Date: Thu, 27 Apr 2017 14:47:45 +0200 Subject: [PATCH] actual AppleScript --- MUA/Apple/Mail/MISP Mail Rule Action.scptd | 1 - MUA/Apple/Mail/MISP Mail Rule Action.txt | 26 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) delete mode 120000 MUA/Apple/Mail/MISP Mail Rule Action.scptd create mode 100644 MUA/Apple/Mail/MISP Mail Rule Action.txt diff --git a/MUA/Apple/Mail/MISP Mail Rule Action.scptd b/MUA/Apple/Mail/MISP Mail Rule Action.scptd deleted file mode 120000 index 7650689..0000000 --- a/MUA/Apple/Mail/MISP Mail Rule Action.scptd +++ /dev/null @@ -1 +0,0 @@ -/Users/rommelfs/Library/Application Scripts/com.apple.mail/MISP Mail Rule Action.scptd \ No newline at end of file diff --git a/MUA/Apple/Mail/MISP Mail Rule Action.txt b/MUA/Apple/Mail/MISP Mail Rule Action.txt new file mode 100644 index 0000000..9cd3566 --- /dev/null +++ b/MUA/Apple/Mail/MISP Mail Rule Action.txt @@ -0,0 +1,26 @@ +using terms from application "Mail" + on perform mail action with messages these_messages for rule this_rule + tell application "Mail" + set the message_count to the count of these_messages + repeat with i from 1 to the message_count + set this_message to item i of these_messages + + try + set this_subject to (subject of this_message) as Unicode text + if this_subject is "" then error + on error + set this_subject to "NO SUBJECT" + end try + + try + set this_content to (every character of content of this_message) as Unicode text + if this_content is in {"", "?"} then error + on error error_message + set this_content to "NO CONTENT" + end try + do shell script "/opt/local/bin/python2.7 /Users/rommelfs/Scripts/mail_to_misp/mail_to_misp.py " & quoted form of this_content & " " & quoted form of this_subject + end repeat + end tell + end perform mail action with messages +end using terms from +