Emailing out of Tinderbox with Ventura

Hi there, I could use some help tracking down a runCommand terminal error.

See attached file. If you add the script below to the Script Editor, select SampleEmail in the attached file (an Mail is your default email client) then you can send an email from Tinderbox.

TBX L - Email From Tinderbox.tbx (246.5 KB)

I’m trying to trigger this from a stamp and it is not working (it used to prior to the Ventura update).

Following the 12MARE23 meetup, I was advised to test in Terminal. Great advice. I found the first error, Terminal did not have permissions. Fixed that. Second, I’m getting the following error after running this command cat EmailScript3.txt | /usr/bin/osascript:

-[NSConcreteAttributedString initWithHTML:documentAttributes:]: value passed to argument of type ^@ must be either `missing value' or `reference'; assuming `missing value'.

The text o fEmailScript3.txt is the Apple Script below.

I don’t know enough about AppleScript or initWithHTML:documentAttributes to work out how to fix this.

Does anyone of any ideas?

Here is my AppleScript

use framework "Foundation"
set ca to current application

-- Produce email copy

runStamp("Create theText for selected note")

to runStamp(stampName)
	activate application "Tinderbox 9"
	tell application "System Events" to click menu item stampName of menu "Stamps" of menu bar item "Stamps" of menu bar 1 of process "Tinderbox 9"
end runStamp

-- classes, constants, and enums used
property NSUTF8StringEncoding : a reference to 4
property NSSharingServiceNameComposeEmail : a reference to current application's NSSharingServiceNameComposeEmail
property NSAttributedString : a reference to current application's NSAttributedString
property NSString : a reference to current application's NSString
property NSSharingService : a reference to current application's NSSharingService


-- The inputs (to be retrieved from Tinderbox or wherever)
tell front document of application "Tinderbox 9"
	tell selection 1
		set theHTML to value of attribute "theText"
		set messageSubject to value of attribute "Subject"
		set recipientAddresses to value of attribute "Recipients"
	end tell
end tell


-- Convert the html to NSAttributedString
set theSource to ca's NSString's stringWithString:theHTML
set theData to theSource's dataUsingEncoding:(ca's NSUTF8StringEncoding)
set anAttributedString to ca's NSAttributedString's alloc()'s initWithHTML:theData documentAttributes:{}

-- Use NSSharingService to create email, preserving the formatting in contents
set aSharingService to ca's NSSharingService's sharingServiceNamed:(ca's NSSharingServiceNameComposeEmail)
if aSharingService's canPerformWithItems:{"someone@somewhere.com"} then
	set aSharingService's subject to messageSubject
	set aSharingService's recipients to recipientAddresses
	tell aSharingService to performSelectorOnMainThread:"performWithItems:" withObject:{anAttributedString} waitUntilDone:false
end if

-- Remove email copy
runStamp2("ClearEmail")

to runStamp2(stampName2)
	activate application "Tinderbox 9"
	tell application "System Events" to click menu item stampName2 of menu "Stamps" of menu bar item "Stamps" of menu bar 1 of process "Tinderbox 9"
end runStamp2

Is sample html selected when you use the stamp?

I believe so.