2012-11-09 3 views
1

특정 시작 날짜를 기준으로 6 주 동안 다양한 클라이언트에 대해 iCal 이벤트를 예약했습니다. 즉 클라이언트 1,2,3가 다음 월요일에 시작하고 다른 AppleScripts 등을 트리거하는 6 주 동안 설정된 여러 iCal 이벤트가 있습니다. (정상 작동하지만 ...)AppleScript로 특정 iCal 이벤트를 1 주일 단위로 이동

클라이언트 2가 1과 3보다 1 주일 늦게 프로그램에 참가하려면 이미 자신의 이벤트 일정을 잡았습니다. 이미 iCal에서 클라이언트 2를 위해 만든 이벤트를 선택하고 일주일에 모두 위로 이동하려면 어떻게해야합니까? 이것은 내가 (그들 모두는 분명히 다른 시작 날짜를 가지고 불평등 이격) 일주 모두를 위로 이동 어떻게 지금, 이벤트를 선택합니다

tell application "Calendar" 
tell calendar "ExampleCalendar" 
set theEventList to every event whose summary contains "Client2" 
end tell 
end tell 

: 여기

내가 지금까지있어 무엇

이렇게하면 내 인생이 훨씬 쉬워 질 것입니다! 고맙습니다.

답변

1

업데이트 :

요세미티 사용자 이제 reference selected Calendar events in AppleScript

시도 : 여기

set daysAdded to 7 

tell application "iCal" 
    tell calendar "ExampleCalendar" 
     set theEventList to every event whose summary contains "Client2" 
     repeat with anEvent in theEventList 
      tell anEvent 
       set it's end date to (it's end date) + daysAdded * days 
       set it's start date to (it's start date) + daysAdded * days 
      end tell 
     end repeat 
    end tell 
end tell 

대체 방법입니다.

 tell anEvent 
      set {sDate, eDate} to {(it's start date), (it's end date)} 
      set it's start date to sDate + daysAdded * days 
      set it's end date to eDate + daysAdded * days 
     end tell 
+0

고맙습니다. 작동합니다 (대부분). 상황은 다음과 같습니다. 이벤트의 시작 날짜가 7 일 이동되었지만 새로운 종료 날짜는 새 시작 날짜로부터 7 일입니다. 즉 사건은 이제 7 일 동안 지속되었다. 줄을 지우면 : '종료일이 (종료일) + daysAdded * days'으로 설정되면 이벤트가 이동되지만 새 종료 날짜는 이제 새 시작 날짜와 동일하게됩니다. – coachpienaar

+0

종료 날짜를 수동으로 설정해야합니까? "시작 날짜를 시작일 + daysAdded * days"로 설정해야합니다. –

+0

@ user1812282. 좋은 지적. 명령 순서를 변경하면 문제가 해결됩니다. 내 편집 된 버전보기. – adayzdone

관련 문제