2015-01-29 2 views
0

Outlook 2011에서는 순수 약속 일정 항목 (참석자가없는 사용자)을 복사하려면 option-click-drag을 지원하지만 회의 항목을 복사하거나 복제 할 수있는 기능은 없습니다 (참석자). AppleScript에서이 작업을 수행 할 수있는 방법이 있어야한다고 생각합니다.AppleScript로 Outlook 2011에서 회의를 복사 (복제)

답변

0

코드는 먼저 Outlook에서 선택한 일정 이벤트가 있는지 확인합니다. 그런 다음 서브 루틴을 호출하여 복사합니다.

AppleScript가 문자열을 Outlook 유형의 클래스로 강제 변환 할 수 없다고 불평 했으므로 새 이벤트의 속성 목록을 원래대로 설정할 수 없었습니다. 매우 실망스럽고, AppleScript로 더 나은 사람이 쉽게 해결할 수있는 가능성이 있습니다. 그러나 시행 착오를 거쳐 프로퍼티를 null이 아닌 문자열로 설정하는 것이 효과적이라는 것을 알게되었으므로 이벤트의 필수 속성에 변수 세트를 설정하고 null이 아닌 경우 새 이벤트의 속성을 설정합니다 그것에.

(* 

-------------------------------------------- 
Duplicate Calendar Event 1.0 
------------------------------------------- 

based on "Set Custom Reminder 1.0" by William Smith <[email protected]> 

It is only compatible with Outlook for Mac 2011. 
-------------------------------------------- 

This script duplicates a calendar event that has attendees. 

(Outlook supports option-click-drag to copy a pure appointment event, one with no 
attendees, but does not support any means of copying or duplicating a meeting 
event with attendees) 


*) 

tell application "Microsoft Outlook" 

    -- Is the event selected in the Calendar view of the Main Window? 

    if class of front window is main window and view of front window is calendar view then 

     -- If so... 

     set orig_event to the selection 

     if class of orig_event is calendar event then 

      my copy_event(orig_event) 

     end if 

     -- Is this a new unsaved appointment or meeting? 

    else if class of front window is window and object of front window is missing value then 

     -- If so... 

     display dialog "Unsaved events cannot be copied. Save your event and run this script again." with title "Alert!" with icon 2 buttons {"OK"} default button {"OK"} 

    else if class of front window is window and (class of object of front window) is calendar event then 

     -- If so... 

     set orig_event to object of front window 

     my copy_event(orig_event) 

    else 

     -- No calendar event appears to be selected or open. Therefore... 

     display dialog "Select an event from your calendar first or open its window." with title "Alert!" with icon 2 buttons {"OK"} default button {"OK"} 
    end if 

end tell 


------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 

on copy_event(orig_event) 

    tell application "Microsoft Outlook" 

     set the_properties to properties of orig_event 

     set Loc to "" 
     --set Rec to "" -- don't know how to handle recurrence since it itself is a list 
     set RecID to "" 
     set Subj to "" 
     set StarT to "" 
     set StarD to "" 
     set EndT to "" 
     set EndD to "" 
     set Cont to "" 
     set Rem to "" 

     if ((location of the_properties) as string) does not contain "missing value" then set Loc to (location of the_properties) 
     if ((recurrence id of the_properties) as string) does not contain "missing value" then set RecID to (recurrence id of the_properties) 
     if ((subject of the_properties) as string) does not contain "missing value" then set Subj to ((subject of the_properties) as string) 
     if ((start time of the_properties) as string) does not contain "missing value" then set StarT to (start time of the_properties) 
     if ((end time of the_properties) as string) does not contain "missing value" then set EndT to (end time of the_properties) 
     if ((content of the_properties) as string) does not contain "missing value" then set Cont to (content of the_properties) 
     if ((reminder time of the_properties) as string) does not contain "missing value" then set Rem to (reminder time of the_properties) 
     set Cat to (category of the_properties) 

     make new calendar event with properties ¬ 
      {location:Loc, subject:Subj, content:Cont, start time:StarT, end time:EndT, reminder time:Rem, category:Cat} 

     set theID to the result 
     --display dialog "created new event" 


     set the_attendees to every optional attendee of orig_event 
     set attendee_count to count of the_attendees 
     --display dialog "event has " & attendee_count & " optional attendees" 
     repeat with an_attendee in the_attendees 
      set attendee_properties to properties of an_attendee 
      set att_name to ((name of (email address of attendee_properties)) as string) 
      set att_email to ((address of (email address of attendee_properties)) as string) 
      make new optional attendee at theID with properties {email address:{name:att_name, address:att_email}} 
     end repeat 

     set the_attendees to every required attendee of orig_event 
     set attendee_count to count of the_attendees 
     --display dialog "event has " & attendee_count & " required attendees" 
     repeat with an_attendee in the_attendees 
      set attendee_properties to properties of an_attendee 
      set att_name to ((name of (email address of attendee_properties)) as string) 
      set att_email to ((address of (email address of attendee_properties)) as string) 
      make new required attendee at theID with properties {email address:{name:att_name, address:att_email}} 
     end repeat 

     set the_attendees to every resource attendee of orig_event 
     set attendee_count to count of the_attendees 
     --display dialog "event has " & attendee_count & " resource attendees" 
     repeat with an_attendee in the_attendees 
      set attendee_properties to properties of an_attendee 
      set att_name to ((name of (email address of attendee_properties)) as string) 
      set att_email to ((address of (email address of attendee_properties)) as string) 
      make new resource attendee at theID with properties {email address:{name:att_name, address:att_email}} 
     end repeat 

     --send meeting theID -- don't send the meeting, give owner a chance to edit first 
     open theID 

    end tell 

    return 

end copy_event 

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 

on lowercase(aString) 
    set NewString to do shell script "echo " & aString & " | tr '[A-Z]' '[a-z]'" 
    return NewString 
end lowercase