2010-02-03 5 views
0

다음 AppleScript (아래)가 있습니다. 나는 이메일을 보내는 것을 확인하려고 시도하고있다. 이 AppleScript는 이미 Mail.app에서 Mail Act-On을 사용하여 "보낼 편지함 규칙"에 성공적으로 연결되어 있으며, 보낼 때 (실행시)에 실행되는지 확인했습니다.전자 메일이 AppleScript로 보내지는 것을 막으십시오.

궁극적 인 목표는 사용자에게 "정말로"이메일을 보내려는지 묻는 대화 상자를 띄우는 것입니다. 그렇지 않은 경우 이메일 전송을 중지하십시오.

현재 스크립트가 메시지를 삭제하려고 시도하지만 작동하지 않습니다. 어떤 아이디어?

using terms from application "Mail" 
    on perform mail action with messages messageList for rule theRule 

     repeat with thisMessage in messageList 

      set theResult to display dialog "Send?" buttons {"OK", "Cancel"} default button 2 
      if button returned of theResult is not equal to "OK" then 
       delete thisMessage 
      end if 

     end repeat 
    end perform mail action with messages 
end using terms from 

답변

1

은 내가 display dialog에서 "취소"버튼을 즉시 delete thisMessage 라인이 실행되지 않음을 의미 스크립트의 실행을 종료합니다 생각합니다.

당신은 변화하려고 생각하고 뭔가 같은 :

set theResult to display dialog "Send?" buttons {"OK", "No, Delete Message"} default button 2 
if button returned of theResult is not equal to "OK" then 
... 
관련 문제