@pete31 would program this more elegantly, I’m sure, but this should provide you with an input dialogue:
-- Show search results for search term containing non-indexed character(s)
tell application id "DNtp"
try
set theRecords to selected records
if theRecords = {} then error "Please select some groups"
set theResults to {}
set dAnswer to "#Action"
set userEntry to display dialog ¬
"Enter the non-indexed character you wish to find" default answer dAnswer with title "Find a non-indexed character"
set theSearchTerm to text returned of userEntry
repeat with thisRecord in theRecords
set thisRecord_Type to (type of thisRecord) as string
if thisRecord_Type is in {"group", "«constant ****DTgr»"} then
set thisRecord_UUID to uuid of thisRecord
set theResults to theResults & (contents of database of thisRecord whose plain text contains theSearchTerm and uuid of parents contains thisRecord_UUID)
end if
end repeat
set theWindow to open window for record (root of viewer window 1) with force
set search results of theWindow to theResults
activate
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
return
end try
end tell
Stephen