I have used two scripts based on Eric’s/Christian’s original script with minor modifications;
– Smart template adding a localized project template to the current group
They both worked fine for years, until upgrading to Ventura.
Now one works fine, and the other gives this error;
An error occurred when accessing your Contacts card.
Please select your address card in Contacts and mark it as your card (via the menu command Card > Make This My Card). Then try again to use this template.
I have checked my contact card and it was marked as “My Card”. I tried marking a different card, then tried deleting my card and adding a new card etc., but still won’t work.
Any ideas what to try next?
Script 1 (works fine)
-- Smart template adding a localized project template to the current group
-- Written by Eric Böhnisch-Volkmann, modified by Christian Grunenberg
-- © 2009–2016 DEVONtechnologies, LLC
-- Default non-localized project name, also used to identify the resources
property pTemplateName : "%project%"
property pAboutDocument : "About this project"
property pBlackColor : {0, 0, 0} -- RTF text color
-- Import helper library
tell application "Finder" to set pathToAdditions to ((path to application id "DNtp" as string) & "Contents:Resources:Template Script Additions.scpt") as alias
set helperLibrary to load script pathToAdditions
try
-- We're later working in DEVONthink, we need to cache localized strings while still in our realm
set theProjectName to localized string pTemplateName
tell application id "DNtp"
-- Let the user change the project name
set theProjectName to display name editor my helperLibrary's localizedString(pTemplateName) default answer "New Distributor" info (my helperLibrary's localizedString("Please enter a name for this Distributor")) as string
set thePlaceholders to {|%project%|:theProjectName}
-- Import the predefined structure
set theTemplateFiles to helperLibrary's pathToLocalizedResources() & my helperLibrary's localizedString(pTemplateName)
set theRecord to import theTemplateFiles placeholders thePlaceholders to current group
set (name of theRecord) to (name of theRecord) -- Rename to user-defined project name
end tell
on error errMsg number errNum
if errNum ≠ -128 then display alert (localized string "An error occured when creating the new project structure") message errMsg as warning
end try
Script 2 (causes card error)
-- Smart template adding a localized project template to the current group
-- Written by Eric Böhnisch-Volkmann, modified by Christian Grunenberg
-- © 2009–2016 DEVONtechnologies, LLC
-- Default non-localized project name, also used to identify the resources
property pTemplateName : "%groupName%"
property pAboutDocument : "About this project"
property pBlackColor : {0, 0, 0} -- RTF text color
-- Import helper library
tell application "Finder" to set pathToAdditions to ((path to application id "DNtp" as string) & "Contents:Resources:Template Script Additions.scpt") as alias
set helperLibrary to load script pathToAdditions
try
-- We're later working in DEVONthink, we need to cache localized strings while still in our realm
set theProjectName to localized string pTemplateName
tell application id "DNtp"
-- Let the user change the project name
set theProjectName to display name editor my helperLibrary's localizedString(pTemplateName) default answer "New Project" info (my helperLibrary's localizedString("Please enter a name for this project")) as string
set thePlaceholders to {|%project%|:theProjectName}
-- Import the predefined structure
set theTemplateFiles to helperLibrary's pathToLocalizedResources() & my helperLibrary's localizedString(pTemplateName)
set theRecord to import theTemplateFiles placeholders thePlaceholders to current group
set (name of theRecord) to (name of theRecord & ": " & theProjectName as string) -- Rename to user-defined project name
end tell
on error errMsg number errNum
if errNum ≠ -128 then display alert (localized string "An error occured when creating the new project structure") message errMsg as warning
end try