I’m trying to write a script which lets the user select an item from a list of around a hundred items. The search box should autocomplete as the user enters text. I’ve done much searching on the Internet, but the majority of options I’ve found require references to an HTML element which stores the list, which I’m guessing is not applicable in Drafts.
The Prompt script object is used for getting user input, but the prompt documentation lists nothing for that sort of autocomplete. Therefore, you would probably need to consider calling out to a separate app to offer this functionality.
On i*OS, Shortcuts doesn’t offer this, but might be Bale to do something based on HTML with a web view. Scriptable certainly could, and I suspect Pythonista probably could offer something with its UI builder, but I haven’t checked to confirm this.
On macOS, you would need something that allows for URL calls, but that’s a pretty wide field. AppleScript is coming for Drafts and would open up some other options around this on the Mac.
Choose from list displays a list you can tap on for selection. There isn’t a field which allows you to start typing text and filtering the list for a string that matches.
For what it’s worth, @martinperry posted a Scriptable based query on this over on the Automators forum. I ended up posting a solution to it there for producing such a list in a web view and how to call and pass back the selection to Drafts. That seemed to meet the requirements by the looks of it.
That looks like the search built into the app for searching for shortcuts rather than the choose from list in Shortcuts that can be utilised for automations, which as far as I can tell has no search field.
Also: if you’re choosing from a list of externally held items (e.g. items returned from a Drafts query or Trello) you don’t even need to activate the “search multiple” setting. Not sure exactly why that makes a difference, but not complaining. True, this has to be run in-app rather than from a widget or anywhere else…
I think multiple selection is a bad option for a single select list, but if only for an individual’s use then it could be a viable approach. It is just very strange that the select multiple is required to enable it. It seems the same is true for some other data types as well as text (e.g. contacts), but for some others, including internal ones like reminders, it does show the search.
Ahhhh! Was just playing with a new shortcut based on a Drafts workspace and realised the mistake in what I’d suggested. If “select multiple” isn’t selected, I think the search box appears for lists that have more than 10 items?
@dfay@jsamlarose@sylumer My main aim was to select items from my favourites in AnyList. I have decided to go with the shortcut below called from within Drafts. It doesn’t have autocomplete (and I need to manually recreate my favourites as a list within the shortcut) but it works well for me. It also allows for multiple selection.
These last couple of years Shortcuts betas have been all over the place. Great stuff, but more issues than I would expect for beta.
Even on i*OS13 today I still have problems in that Siri has never been able to run a Shortcut by name on any device, and when opening a new shortcut it always takes a minute or two (not a figurative minute, an actual minute) before I can search for actions and have any returned. These have been issues since the start for me and I purposefully didn’t do the betas last year or this because of the volumes of issues I’ve seen; and I beta test for over a dozen app developers on Mac and i*OS all the time.
I’d been hoping for a stability release with 14, but anecdotes like this make me fear that things will simply get worse
Indeed— MGCheckList prompts completely fulfil my “list prompt with filter” needs in Drafts these days…
One thing I haven’t yet done is use an MGCheckList as a menu for actions that begin/end outside of Drafts. I still use Editorial like this, occasionally. I imagine it wouldn’t take much to make that switch, though.