Start a new topic

More Generic Capture Template- issue with (set-current-item-headline)

 So recently I asked about the possibility of creating dynamically numbered headlines in an effort to easily capture consecutive workout sets. I thought of a way to create a more generic capture template and have almost effected it but for one problem.


Just as a quick background, i have many templates that all have the same thing in their notes, but the difference is the headline is the name of the movement. So after i complete a set, i swipe, find the movement, and fill out the template and the notes and sets get added to the same subtree since the movement type is the subtree each one gets added to. 


I thought there must be a way to choose the movement at or around capture time so that i could just have one template, since the stored information is nearly all identical, and the sheets functionality caught my eye in the scripting section of the website. So i created a sheet with all the possible movements I could do, and added that sheet to the item editor so i could change the headline of the current item during  capture.



 

(define (show-movement-options)
  (sheet '(("Bench Press" (insert "Bench Press"))
           ("Incline Bench" (insert "Incline Bench"))
           ("Touch and Go Bench" (insert "Touch and Go Bench"))
           ("High-bar Squat" (insert "High-bar Squat"))
           ("Deadlift" (insert "Deadlift"))
           ("Romanian DL" (insert "Romanian DL"))
           ("Overhead Press" (insert "Overhead Press"))
           ("Barbell Row" (insert "Barbell Row"))
           ("Lying Triceps Extension" (insert "Lying Triceps Extenstion"))
           ("Ab Work" (insert "Ab Work"))
           ("Dumbbell Curls" (insert "Dumbbell Curls"))
           ("One-arm Dumbbell Rows" (insert "One-arm Dumbbell Rows"))
           ("Dumbbell Lunges" (insert "Dumbbell Lunges")))))

 And beneath that:



 

(set! item-editor-menu
  '(("Assign current location" (add-location-to-current-item))
    ("Make top priority today" (make-current-item-top-priority-today))
    ("Schedule for tomorrow" (schedule-current-item-for-tomorrow))
    ("Remove all dates" (remove-all-dates-from-current-item))
    ("Set Headline to Exercise Type" (set-current-item-headline! (show-movement-options)))))

 But when i go to change the headline at capture time, it just blanks the placeholder headline from the capture template and doesn't insert the text selected from the sheet. Is there an easier way to do this? Does this make sense? What am i missing about the little sheet i've created?


Thanks


I think you'll need to change your sheet to set the current item headline, rather than use insert. Insert is a command for use in the text editor, but there isn't a text editor currently active.


I haven't tried this myself, but see if the following works:


(define (show-movement-options)
  (sheet '(("Bench Press" (set-current-item-headline! "Bench Press"))
           ("Incline Bench" (set-current-item-headline! "Incline Bench"))
           ("Touch and Go Bench" (set-current-item-headline! "Touch and Go Bench"))
           ("High-bar Squat" (set-current-item-headline! "High-bar Squat"))
           ("Deadlift" (set-current-item-headline! "Deadlift"))
           ("Romanian DL" (set-current-item-headline! "Romanian DL"))
           ("Overhead Press" (set-current-item-headline! "Overhead Press"))
           ("Barbell Row" (set-current-item-headline! "Barbell Row"))
           ("Lying Triceps Extension" (set-current-item-headline! "Lying Triceps Extenstion"))
           ("Ab Work" (set-current-item-headline! "Ab Work"))
           ("Dumbbell Curls" (set-current-item-headline! "Dumbbell Curls"))
           ("One-arm Dumbbell Rows" (set-current-item-headline! "One-arm Dumbbell Rows"))
           ("Dumbbell Lunges" (set-current-item-headline! "Dumbbell Lunges")))))

(set! item-editor-menu
  '(("Assign current location" (add-location-to-current-item))
    ("Make top priority today" (make-current-item-top-priority-today))
    ("Schedule for tomorrow" (schedule-current-item-for-tomorrow))
    ("Remove all dates" (remove-all-dates-from-current-item))
    ("Set Headline to Exercise Type" (show-movement-options))))



1 person likes this

Hey that worked! Thank you Matthew. Final question, happy to make another issue or topic if you want: is it possible to choose which headline the captured item gets added to as a subitem at capture time?


Thanks,

Micah

Its not possible at the moment to use a similar technique to change the item to a subitem. Something I'll need to have a think about how that could work.

Login or Signup to post a comment