Outlook for Mac

Outlook Applescript question

待回答 0 个回答

较早的帖子,发布于 2015年7月15日。 其中的信息可能已经过时。

本帖暂无中文翻译,以下为英文原文。

问题 提问于 2015年7月15日

I have a Hazel 

rule that’s watching a folder for any file added today. When it detects a file, it runs the following Applescript: 

tell application "Microsoft Outlook" to activate

set recipientName to "Jerry"
set recipientAddress to "*** Email address is removed for privacy ***"
set theSubject to "Kramer's Invoice"
set theContent to "Please find Kramer's invoice attached.

Regards,
Jerry

"
set theAttachment to theFile

tell application "Microsoft Outlook"
   set theMessage to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}
   tell theMessage
      make new to recipient with properties {name:recipientName, address:recipientAddress}
      make new attachment with properties {file name:theAttachment} at after the last character
   end tell
end tell

For some reason when this rule is saved, it’s changing the second instance of tell application "Microsoft Outlook" to tell application "Mail”. No matter how many times I try it just keeps changing it. Any thoughts on why and how to fix would be greatly appreciated. 

Once that’s solved my goal is to introduce a date variable into both the Subject and Content of the email, i.e. I’d like the script to auto-detect the current month and populate accordingly so that ‘Kramer’s Invoice’ becomes ‘Kramer’s July Invoice’ and ‘Please find Kramer’s invoice attached’ becomes ‘Please find Kramer’s July Invoice attached’. 

Having raised this issue with the Hazel forum, I’m told it’s an Applescript issue specific to Outlook. I’ve tested the script outside of Hazel using Apple’s Script Editor and it returns an error: Expected expression, etc. but found “:”. Within the script itself, the editor is highlighting the colon after {file name:

Any thoughts on how I can resolve would be greatly appreciated. Thanks

暂无回答

撰写回答

您的邮箱地址不会被公开。请勿发布密码。

This site uses Akismet to reduce spam. Learn how your comment data is processed.