명령 행을 통해 미리 알림을 추가하려면 어떻게해야합니까? iCloud와 동기화되어 있기

가끔 명령 줄에서 Reminders.app에 알림을 추가하는 것이 유용 할 수 있습니다. 특히 알림이 iCloud와 동기화되어 있기 때문입니다. 그렇게 할 방법이 있습니까?

AppleScript에 의존하지 않는 솔루션이 선호 됩니다.



답변

osascript - title <<END
on run a
tell app "Reminders"
tell list "Reminders" of default account
make new reminder with properties {name:item 1 of a}
end
end
end
END

비어있는 새 알림 항목 작업만으로 Automator 워크 플로를 만든 다음로 실행할 수 있습니다 automator -i title test.workflow.

Mac OS X 힌트에서이 게시물을 참조하십시오 .


답변

다음은 명령 줄 인수를 통해 제목, 종료 날짜 및 시간을 설정할 수있는 다른 버전입니다.

#!/usr/bin/env bash                                                                                                               
# Make a new reminder via terminal script                                                                                         
# args: remind <title> <date> <time>                                                                                                                                                                                 

osascript - "$1" "$2" "$3" <<END
on run argv
    set stringedAll to date (item 2 of argv & " " & item 3 of argv)
    tell application "Reminders"
        make new reminder with properties {name:item 1 of argv, due date:stringedAll}
    end tell
end run
END    

따라서이 스크립트의 이름을 “리마인드”로하고 실행 권한을 부여하면 (chmod 755 리마인더) 다음을 수행 할 수 있습니다.

$ ./remind "Go to grocery store" 12/15/2013 10:00:00PM                              

답변

tell application "Reminders"
    activate
    show list "Reminders"
end tell
set stringedDate to "12/11/2015"
set stringedHour to "10:00:00PM"
set stringedAll to date (stringedDate & " " & stringedHour)
tell application "Reminders" to tell list "Reminders" of default account to make new reminder with properties {name:"this is just test remainder", remind me date:stringedAll, due date:stringedAll, priority:1}

답변

위의 AppleScript와 동일한 기능이 있습니다. 그러나 ES6이있는 JXA에서는.

#!/usr/bin/env osascript -l JavaScript

const RemindersApp = Application('Reminders');

function run(argv) {
    [name, date, time] = argv;
    dueDate = new Date(date + " " + time);
    reminder = RemindersApp.Reminder({name: name, dueDate: dueDate});
    RemindersApp.defaultList.reminders.push(reminder);
}

답변

이 github 프로젝트는 훌륭하게 작동하며 AppleScript를 사용하지 않습니다. 컴파일 된 XCode 앱입니다.

https://github.com/keith/reminders-cli