I want to insert a date picker into a text expander snippet; is that possible?

Does anyone know if it’s possible to create a TE snippet with a Date Picker like the one found here..

When I try to run it, I get this error:

	JavaScript Error: SyntaxError - Unexpected token '<'

Is it not possible to run that through TextExpander, or am I missing something else?

JQuery only runs in a browser document. TextExpander does not run in the browser so there would be nowhere to display the picker.

You could perhaps set Textexpander to open a picker like that in your local browser and then edit the Javascript code to save the result to the clipboard.

There is an alternative way to get a date picker in TextExpander, by using the Shortcuts app and some shell script.

Make a snippet with the following code:

#!/bin/zsh
pickedDate=$(shortcuts run "get date")
echo -n "$pickedDate"

Make the following Shortcut with the name “get date”


You can format the date of the Ask action as required.

To get the date to the TextExpander snippet the “Provide Output” box has to be ticked in the settings of the Shortcut.

2 Likes

It is not totally working the correct way, I’m sorry to say that I didn’t test it long enough (because I had to go to bed).

If I run the snippet I get an error after 5 seconds.

So you have 5 seconds to choose the date, which is not handy.

I tried to find a solution for this, but couldn’t find it. Then I tried to rewrite the snippet to AppleScript, but there I run into a permission error I couldn’t solve.

I’m running a old version of TextExpander (I moved most snippets to Keyboard Maestro), so maybe it works in a newer version.

I hope someone with more experience with shell scripts in TextExpander knows a solution,

Thanks for that; I think maybe I’m asking too much, but sometimes I just need a visual of a calendar in front of me in order to figure out a date for something, and it’s easier if it’s in the snippet. I thought there was a time when TE supported it in the app, but there’s nothing here to indicate that specific option exists.

It’s a pity. But you can still use the Siri Shortcuts app. After picking the date you can copy the date to the clipboard instead and then paste it into the document.

To start the Shortcut you can assign a key combination to it, in the settings of the Shortcut…

I’m glad to hear that I’m not the only one who needs this!