Skip to content

Instantly share code, notes, and snippets.

@fkscott
Last active January 12, 2024 00:01
Show Gist options
  • Save fkscott/e9560924307e1e265ac6e720f3746e01 to your computer and use it in GitHub Desktop.
Save fkscott/e9560924307e1e265ac6e720f3746e01 to your computer and use it in GitHub Desktop.
Bike Daily Journal Script
# Forked from https://bikeguide.hogbaysoftware.com/customizing-bike/creating-scripts#today-script
# I modified each day’s label format to date +'%a, %B %e, %Y' so I can do fuzzy searches for dates like Sun Sep 24.
# The script rolls over unfinished tasks from the previous day to the next
set yearName to do shell script "date +'%Y'"
set yearId to do shell script "date +'%Y'" & "/00/00"
set monthName to do shell script "date +'%B'"
set monthId to do shell script "date +'%Y_%m'" & "/00"
set dayName to do shell script "date +'%a, %B %e, %Y'"
set dayId to do shell script "date +'%Y_%m_%d'"
tell application "Bike"
tell front document
set y to my getOrMake(yearId, yearName, root row)
set m to my getOrMake(monthId, monthName, y)
set d to my getOrMake(dayId, dayName, m)
select at make row at back of rows of d
set focused row to d
end tell
end tell
to getOrMake(getId, getName, rowContainer)
using terms from application "Bike"
tell container document of rowContainer
if exists row id getId then
return row id getId
else
tell rowContainer
return make row with properties {id:getId, name:getName}
end tell
end if
end tell
end using terms from
end getOrMake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment