summaryrefslogtreecommitdiff
path: root/mac/.config/sketchybar.mon/plugins/nextevent.applescript
blob: 6ffc56adaf35e1feaba4fd1d9e6511f1fc9eeead (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
set input to paragraphs of (do shell script "/opt/homebrew/bin/icalBuddy -ec 'Found in Natural Language,CCSF' -npn -nc -iep 'datetime,title' -po 'datetime,title' -eed -ea -n -li 4 -ps '|: |' -b '' eventsToday")

set currentTime to date (do shell script "date '+%I:%M %p'")

set theEvent to ""

if input is not "" then
	repeat with anEvent in input
		set text item delimiters to "^"
		set eventTime to date (text item 1 of anEvent)
		set text item delimiters to ""
		if eventTime > currentTime then
			set theEvent to anEvent as string
			exit repeat
		end if
	end repeat
end if

return theEvent