0

Outlook 2011 は、純粋な予定の予定表アイテム (出席者のいないもの) をコピーするオプション クリック アンド ドラッグをサポートしていますが、会議アイテム (出席者のあるもの) をコピーまたは複製する機能はありません。AppleScript でこれを行う方法が必要だと思います。

4

1 に答える 1

0

コードはまず、Outlook で選択されたカレンダー イベントがあることを確認します。次に、サブルーチンを呼び出してコピーします。

新しいイベントのプロパティ リストを元のイベントのプロパティ リストに単純に設定することはできませんでした。これは、AppleScript が文字列を Outlook のどの種類のクラスにも強制できないと訴えたためです。非常に苛立たしく、おそらく AppleScript が得意な人なら簡単に解決できる問題です。しかし、試行錯誤の結果、プロパティを null 以外の文字列に設定するとうまくいくことがわかったので、一連の変数をイベントの必須プロパティに設定し、それらが null でない場合は、新しいイベントのプロパティを設定します。それに。

(*

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

based on "Set Custom Reminder 1.0" by William Smith <bill@officeformachelp.com>

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
于 2015-01-29T03:31:35.683 に答える