2012-08-29 4 views
0

직장에서 회사 Exchange에 연결된 Mac 용 Outlook을 사용해야하며, 작은 AppleScript를 함께 사용하여 모니터링 시스템에서받는 전자 메일 메시지의 제목 줄을 변경했습니다. 기본적으로 그들은 경건하지 않은 길이이며 사람이 읽을 수있는 길이 아닙니다. 나는 그것을 고치려고 노력하고있다.Outlook 메시지에 대한 AppleScript 변경 내용이 저장되지 않습니다.

스크립트가 작동하지만 일부 이상한 이유로 테스트 메시지를 직접 보내면 모든 것이 잘 작동하지만 모니터링 시스템의 실제 메시지가 들어 오면 모든 변경 사항이 되돌려집니다! 메시지가 내 편지함에 도착하면 주제가 예를 들어 원하는대로 표시되지만 3-5 초 내에 원본 제목으로 되돌아갑니다.

AppleScript에 대해 아무것도 알지 못하고 어디에서 이런 문제를 해결해야할지 모르겠습니다.

아무에게도 시도해보고 내가 시도하려는 것이 가능하면 알려주시겠습니까? 메시지를 변경하는 유일한 라인

set subject of theMsg to the mysubject as string 

을하기 때문에

on replaceText(find, replace, subject) 
    set prevTIDs to text item delimiters of AppleScript 
    set text item delimiters of AppleScript to find 
    set subject to text items of subject 

    set text item delimiters of AppleScript to replace 
    set subject to "" & subject 
    set text item delimiters of AppleScript to prevTIDs 

    return subject 
end replaceText 

tell application "Microsoft Outlook" 
    set theMessages to the current messages 
end tell 

repeat with theMsg in theMessages 
    tell application "Microsoft Outlook" 
     set mysubject to get the subject of theMsg 
     if mysubject contains "[Subscription:Spectrum CTO] SPECTRUM - " then 
      set mysubject to my replaceText("[Subscription:Spectrum CTO] SPECTRUM - ", "", mysubject) 
      set mysubject to my replaceText("Alarm Title: ", "", mysubject) 
      set mysubject to my replaceText("Severity: ", "", mysubject) 
      set mysubject to my replaceText("Model Name:", "-", mysubject) 
      set subject of theMsg to the mysubject as string 
     end if 
    end tell 
end repeat 

답변

0

확인이 문제는 오른쪽

set subject of theMsg to the mysubject as string

1

는 교환에 문제가있을 것으로 보인다. 도착했을 때 다른 이메일 제목을 설정하기 만 했습니까?

+0

네 전에

delay(3)

를 가산함으로써 해결되었다. 이미 내 사서함에있는 메시지를 변경하면 문제가 없습니다. 그들은 올바르게 저장되고 변경 사항은 Exchange로 전달됩니다. 나는 메시지가 완전히 다운로드되기 전에 내가 주제를 바꾼다는 인상을 받고 있기 때문에 나의 변경 사항을 덮어 쓴다. 아마도 나는 2-3 초의 포즈를 추가 할 수 있습니다 ... – solefald

+0

하! 나는 그것을 고쳤다고 생각한다. 주제를 바꾸려고 시도하기 전에 3 초 지연을 삽입했습니다! 더 테스트 할 것입니다. – solefald

관련 문제