# Auto-select optional section based on date fill-in?

**URL:** <https://community.textexpander.com/t/auto-select-optional-section-based-on-date-fill-in/571>\
**Category:** Have a question?\
**Tags:** snippets, how-to\
**Created:** [April 4, 2026, 4:55pm UTC](https://community.textexpander.com/t/auto-select-optional-section-based-on-date-fill-in/571 "2026-04-04T16:55:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulburchfield](https://sea3.discourse-cdn.com/textexpander/user_avatar/community.textexpander.com/paulburchfield/32/159_2.png) [@paulburchfield](https://community.textexpander.com/u/paulburchfield)\
**Post date:** [April 4, 2026, 4:55pm UTC](https://community.textexpander.com/t/auto-select-optional-section-based-on-date-fill-in/571/1 "2026-04-04T16:55:42Z")

</div>

I have about 6 complex sales email snippets that all share the same basic architecture: two optional sections (“peak” and “off-peak”) that control different blocks of text scattered throughout each snippet, along with nested snippets. These have been refined over a long time and I really don’t want to rearchitect them.

Each snippet also has a date fill-in field (a text field I fill in formatted mm-dd-yy). The rule for which optional section should be selected is simple:

- Peak: Saturday, April through October
- Off-Peak: Everything else

Right now I manually check the correct optional section checkbox every time. The problem is twofold:

1. If I check the wrong one, the wrong pricing and copy goes out.
2. If I forget to check either one, large chunks of the email just don’t appear in the output. I don’t notice until I’ve already filled in all the other fields (customer names, venue, dates, greeting, etc.) and the snippet has expanded. At that point I have to start over and re-enter everything. It’s a real time sink.

What I’m looking for: A way to auto-select the correct optional section (peak or off-peak) based on the date I enter in the fill-in field. Ideally something I can apply across all 6 snippets without duplicating them or converting all the optional sections to JavaScript conditionals.

I’m on TextExpander 8.4.2 on Mac. Is there a way to programmatically control optional section state from a JavaScript or shell script macro? Or another approach I’m not seeing that preserves the current snippet structure?

Appreciate any ideas.

Paul

---

<div class="post-metadata">

**Author:** ![AlexBainov](https://sea3.discourse-cdn.com/textexpander/user_avatar/community.textexpander.com/alexbainov/32/392_2.png) [@AlexBainov](https://community.textexpander.com/u/AlexBainov)\
**Post date:** [April 4, 2026, 11:46pm UTC](https://community.textexpander.com/t/auto-select-optional-section-based-on-date-fill-in/571/2 "2026-04-04T23:46:58Z")

</div>

If I understand correctly, Are you filling in the date because it is being used in various spots? It sounds to me that it would be much easier just to have 2 versions of the snippet and you simply select if you want peak or off peak. I may be misunderstanding your set up.

---

<div class="post-metadata">

**Author:** ![LarrySolesbee](https://avatars.discourse-cdn.com/v4/letter/l/a183cd/32.png) [@LarrySolesbee](https://community.textexpander.com/u/LarrySolesbee)\
**Post date:** [April 4, 2026, 11:57pm UTC](https://community.textexpander.com/t/auto-select-optional-section-based-on-date-fill-in/571/3 "2026-04-04T23:57:05Z")

</div>

Get ChatGPT or Claude to help you write some apple-script to select depending on date, take that portion of code and edit it into your existing snip. To get %fill… Looking code to change to bubbles, switch between text and applescript and back after making any minor edit [like adding and deleting a space] which it needs to understand edit complete

TextExpander staff: is there a way to use non-printing “return” characters to make snippet readable but not expand the spaces and returns surrounding not selected “optional sections”

---

<div class="post-metadata">

**Author:** ![paulburchfield](https://sea3.discourse-cdn.com/textexpander/user_avatar/community.textexpander.com/paulburchfield/32/159_2.png) [@paulburchfield](https://community.textexpander.com/u/paulburchfield)\
**Post date:** [April 6, 2026, 2:34am UTC](https://community.textexpander.com/t/auto-select-optional-section-based-on-date-fill-in/571/4 "2026-04-06T02:34:14Z")

</div>

Hi Alex,

Yes, the date is used in various spots throughout the snippet. But there’s more to it than just peak vs off-peak.

Each snippet has around 20+ fill-in fields (customer name, spouse name, venue, greeting style, event type, etc.) plus about 15 other optional sections beyond peak/off-peak (venue-specific content, greeting variations, contact info toggles, and more). And peak/off-peak aren’t just one block of text each – they each control multiple sections scattered throughout the snippet that change pricing, copy, and other details in different places. I go through the fill-in panel, enter all the details, check the relevant options, and the snippet builds a complete customized email.

Having two versions of each snippet would mean maintaining 12 snippets instead of 6, and every time I update the copy or add a venue or tweak the structure, I’d need to do it in two places. With all the nested snippets involved, that gets fragile fast.

The peak/off-peak logic is the one part that’s fully deterministic – it’s just a function of the date I’m already entering. So ideally I’d love a way to have TextExpander auto-check the right optional section based on that date input, rather than duplicating everything.

---

<div class="post-metadata">

**Author:** ![AlexBainov](https://sea3.discourse-cdn.com/textexpander/user_avatar/community.textexpander.com/alexbainov/32/392_2.png) [@AlexBainov](https://community.textexpander.com/u/AlexBainov)\
**Post date:** [April 6, 2026, 3:23am UTC](https://community.textexpander.com/t/auto-select-optional-section-based-on-date-fill-in/571/5 "2026-04-06T03:23:09Z")

</div>

Got it. I think it would be doable through JavaScript but would be hard to make suggestions or test without seeing your snippet/options.
