I have temp workspace with generated by an action which is working correctly to generate a list of drafts. I would like to include the “search preview” for each draft but I can’t find the script item.
I’d really appreciate some guidance here.
Thanks
Ian
Are you saying you want to utilize the text of the search preview in the script? If so, that is not available - it is a UI element only in the list, not a property that can be accessed. You could certainly generate your own version of it by looking at the matches for your search criteria in a script.
I wanted to specify in the script that the Search Preview should be displayed in the selected drafts.
There is a boolean showSearchPreview
property on the Workspace
object (which I think defaults to true). Looks it that property didn’t get documented, I’ll fix that.
Are they not showing when you load it now? Does the temp workspace have a queryString
value?
No, the Search Preview doesn’t show.
The query string is “@start:2025-06”;
There are drafts containing start dates in the form of “@start:2025-06-27” and I want to see the complete start date on each draft.
If I manually create a Workspace using the above query string and selecting to view Search Preview I have what I want. This would require manually updating the query string which I wish to avoid.
Did you try setting the showSearchPreview
property to true in your script? Perhaps you could share the whole action.
Perfect, thank you. I couldn’t find the “showSearchPreview” property.
“Tickler Dates” Due This Month and Next Month
I have a collection of Drafts containing a Tickler Date (in this case a Start Date in the form of @start:2025-05-23) and using a pair of actions originally written by @FlohGro when such a draft falls due it is moved into my Inbox. This works as it should but I wanted to look at Drafts with Start Dates falling due in the next few weeks.
The action selects by “This Month” or “Next Month” and I also want to see the actual start date - which Search Preview provides.
Thank you for your help with this.
Ian
let tag = "!s::archive"
let queryString = " "
let tDate = Date.today();
let t2Date = Date.today().add({ days: 14 })
let s1Date = strftime(tDate, "%Y-%m");
let s2Date = strftime(t2Date, "%Y-%m")
if (s1Date === s2Date) {
queryString = `@start:${s1Date}`;
} else{
queryString = `@start:${s1Date} OR @start:${s2Date}`;
}
// create workspace
let ws = new Workspace();
ws.name = "Tasks due Soon";
ws.tagFilter = tag
ws.tagFilterRequireAll = true
ws.queryString = queryString;
ws.showSearchPreview = true;
ws.loadFolder = "all";
app.applyWorkspace(ws);
app.showDraftList();
This script is loading the workspace and display the search preview in the list for me on both Mac and iOS.
Yes, it works for me too, thank you, and apologies if I didn’t make that clear on the first line of my last reply.
My original script didn’t contain the showSearchPreview property, which I couldn’t find when I posted my original request.