Placeholders can be inserted via the Insert Placeholder submenu of the contextual menu of text fields in the smart rule & batch processing editors. Or via the new pop-up button at the right edge of these fields:
Okay, thank you - that works. I was trying to type the placeholder - which appears to be possible in some cases but not this case. The documentation seems to imply the name is “Query Response”, and the pop-up says that too - but it appears to be %chatSuggestedResponse% behind the scenes.
The responses fill the metadata field so I’m trying to change the approach to create a new item in the database (with the response and a link to the original item) but it appears I’ll have to shift to an AppleScript approach for that.
Thank you - that example has actually helped a lot. Those script related actions didn’t make sense to me before - but I’m able to do exactly what I want now. Thanks again.
Are the any plans or possibly even already possibilities to expand the use of AI generated placeholders to other kind of fields (like a date field)?
For me, it feels counter-intuitive to use a textfield to hold a date-information.
I feared that you started to become reasonable again
Well - for me this means that I would need to rebuild my data for those documents that currently have a date field - but that is my issue.
Maybe the document date placeholders are already sufficient? E.g. since version 4 it’s possible to set dates, e.g. creation or modification date, to the (newest/oldest) document date via smart rules and batch processing.
In the last days, I testes the built-in possibilities to manipulate date fields, as @cgrunenberg suggested.
Unfortunately, in a document with several dates (like in my case - validity date of the contract, print date of the document and the desired “real” date, when the document was issued).
So I ended up using AI to create a document title in the form of
document date (YYYY-MM-DD) document title (e.g. 2015-05-04 1&1 Telecommunication invoice)
And afterwards, I use an Apple Script to copy the found date into the creation date field.
I have enclosed the script in question, just in case someone is having comparable issues.
tell application id "DNtp"
repeat with thisRecord in (selection as list)
set today to (current date)
set recordName to (name of thisRecord)
-- use the first 10 characters as date string and extract the numbers for year, month and day
set titleDatestring to characters 1 thru 10 of recordName as string
set myYear to characters 1 thru 4 of titleDatestring as string
set myMonth to characters 6 thru 7 of titleDatestring as string
set myDay to characters 9 thru 10 of titleDatestring as string
-- create the date from the extracted information
set day of today to myDay as integer
set month of today to myMonth as integer
set year of today to myYear as integer
-- create a new variable creation to to manipulate further
copy today to creationDate
-- Set the time to midnight (as I do not need it)
set time of creationDate to 0
-- Copy 'creationDate' into 'creation date' in the record's metadata
set creation date of thisRecord to creationDate
end repeat
end tell
I would say so and so.
The basic structure was created by Google Gemini and since that wasn’t working, I was able to find the issues and correct them (this was mainly the way Gemini tried to create the date to be written into the created date field).
As has been mentioned quite a few times, AI-generated scripts are pretty poor. In fact, I could ask more questions about “Why did you do ______ ?”, hence my inquiry about AI.
I would recommend you learn some scripting on your own, especially as the script you presented does a very low-level operation that can easily accomplished. Also note the AI provides no insight into what it’s doing and why.
Here is a learning edition script that does the same function…
tell application id "DNtp"
if (selected records) is {} then return -- If nothing is selected, just stop.
set od to AppleScript's text item delimiters -- Cache the default delimiters
repeat with thisRecord in (selected records)
set recordName to (name without extension of thisRecord) -- "2015-05-04 1&1 Telecommunication invoice"
set AppleScript's text item delimiters to " " -- Split the name on spaces
set theDate to text item 1 of recordName -- Get the date, which is the first item before a space
log theDate --> 2015-05-04
set AppleScript's text item delimiters to "-" -- Split the date on hyphens
set {myYear, myMonth, myDay} to {text item 1, text item 2, text item 3} of theDate -- Grab each date component
set creation date of thisRecord to my getdate({myMonth, myDay, myYear} as string)
-- The order of the date components are locale-aware. In the US, M-D-Y processes to a proper date
set AppleScript's text item delimiters to od -- Set the delimiters back to default
end repeat
end tell
on getdate(theDate)
return date theDate -- The date coercion doesn't work inside a DEVONthink tell block
end getdate