AppleScript Mail: Can't make file into type alias
Some advice please. I'm stumped as to why I keep getting "Can't make file into type alias".
I get this both on my latest M1 desktop and older MacBook (El Capitan). Having looked around I believe I have the appropriate script. Thanks in advance.
on run
set PDFpath to (path to desktop as text) & "Bobbycopy.pdf"
tell application "Mail"
set theSubject to "Scores"
set theContent to "something here"
set theAddress to "email address"
set theAttachmentFile to PDFpath
set msg to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}
tell msg to make new to recipient at end of every to recipient with properties {address:theAddress}
tell msg to make new attachment with properties {file name:theAttachmentFile as alias}
end tell
end run