簡體   English   中英

運行Applescript的郵件規則不起作用?

[英]Mail Rule to Run Applescript Not Working?

向我的AppleScripters同事提問。 我有以下腳本,如果您在AppleScript Editor或Script Debugger中運行它,則該腳本運行得很好,但是,如果您嘗試從Mail規則運行它,則該腳本將根本無法運行。 該腳本已正確放置在〜/ Library / Application Scripts / com.apple.mail中,並顯示在“郵件”規則的“運行AppleScript”菜單中,但是只是在收到新郵件時拒絕工作。

on perform_mail_action(info)
  tell application "Mail"
set theMessages to |SelectedMessages| of info
repeat with thisMessage in theMessages
set AppleScript's text item delimiters to {""}
set thisSender to sender of thisMessage as string
set quotepos to offset of "\"" in thisSender
  if (quotepos is not 0) then
    set thisSender to (text items (quotepos + 1) through -1) ¬
      of thisSender as string
    set quotepos to offset of "\"" in thisSender
    if (quotepos is not 0) then
      set thisSender to (text items 1 through (quotepos - 1)) ¬
        of thisSender as string
    end if
  else
    set atpos to offset of "@" in thisSender
    if (atpos is not 0) then
      set thisSender to (text items 1 through (atpos - 1)) ¬
        of thisSender as string
    end if
    set brkpos to offset of "<" in thisSender
    if (brkpos is not 0) then
      set thisSender to (text items (brkpos + 1) through -1) ¬
        of thisSender as string
      end if
      end if
      tell application "Finder" to say "Mail from " & thisSender
    end repeat
  end tell
end perform_mail_action

有任何想法嗎?

感謝大家的反饋,但我發現了問題所在。 這與腳本毫無關系。 那是因為我在腳本添加文件夾中安裝了Satimage.osax,並且由於它還不完全兼容ML,所以一切都搞砸了。 卸載后,我所有的文件夾操作都開始正常運行!

謝謝!

-安迪(Andy H.)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM