Before creating a new record, the current database is to be searched for the existence of a record with the same content:
set existingEntries to (every content in actualDB whose name is "compare text")
As an result I got sometimes a count of 1 because a record is deleted and in the trash.
It would be nice to extend the selection with a “yep:group & name of group = xyz.name” or “folder = xyz.text” selector, because the same record could still be found in another Folder / Group.
This is what I use – you can trim the excess features
tell application id "DNtp"
set actualDB to the current database
repeat
set search_string to display name editor "Search Text" info "Enter text to find:"
if search_string is not "" then exit repeat
end repeat
set theResults to search search_string in actualDB within text contents
set theLocations to ""
repeat with thisResult in theResults
set theLocations to theLocations & the location of thisResult & name of thisResult & ": " & kind of thisResult & return
end repeat
display dialog theLocations
end tell
Of course, the script does does exactly what this does in Search:
property nameDatabase : "~/Documents/My DMS/xxx.dtBase2"
property nameGroup : „/office/folder1/"
property nameDestinationMailbox : „subfolder“
tell application id "DNtp"
set theDatabase to open database nameDatabase
set theGroup to create location nameGroup & nameDestinationMailbox in the database
set existingEntries to search “searchtext“ in theGroup
set existingRecordNumber to count of existingEntries
if ((count of existingEntries) = 0) then
create record with {…} in theGroup
end if
end tell