- Reminders.appのAppleScript辞書には選択中のリマインダーを取得するコマンドがない
- AppleScriptに対応したアプリケーションではFinderのように
selection
などで取得できるものが多い
- AppleScriptに対応したアプリケーションではFinderのように
- GUI Scriptingを用いて選択中のリマインダーを無理矢理に取得する
- GUI Scriptingを使っているので誤動作する可能性が少し高い
- リマインダーの優先順位を変更するため、選択中のリマインダーをきちんと取得できなかったり元の優先順位が狂ってしまうこともある
- (2016-10-06 追記) Reminders.appでの見た目と取得したリストの順番が異なる
selectedReminders.scpt
my selectedReminders()
--> {reminder id "x-apple-reminder://BC1CD75A-071E-4093-9DF8-39F293B79BA7"}
on selectedReminders()
set now to current date
activate application "Reminders"
tell application "System Events"
set frontmost of process "Reminders" to true
keystroke "1" using {command down}
keystroke "z" using {command down}
end tell
tell application "Reminders"
set reminderList to reminders whose modification date ≥ now
end tell
if reminderList = {} then
tell application "System Events"
keystroke "z" using {command down, shift down}
end tell
end if
return reminderList
end selectedReminders
更新履歴
- 2016-08-30: GUI Scriptingを用いて優先順位を操作する方法で作成
- 2016-09-01: 選択中のリマインダー以外を取得してしまう不具合を修正
- 2016-09-01: Reminders.appで1つもリマインダーを選択していない場合に対応