我正在开发一个在Mail中生成电子邮件的AppleScript-ObjC应用程序。我的UI有三个IBOutlets (两个文本字段和一个弹出菜单),用户可以在其中输入将被填充到电子邮件中的文本。我可以将这些输出中的值保存到变量中,但是当我试图在tell应用程序"Mail“语句中使用这些变量时,我会得到以下错误:
AppleEvents:接收mach,它不是getMemoryReference中所期望的复杂类型。
下面是日志中的指纹:
(
"<NSAppleEventDescriptor: 'ctxt'>",
": ",
"Status: MyProjectName, Part No.: 12345"
)看来ctxt (我认为是NSString)和AppleScript字符串有区别,但我不知道如何转换为AppleScript字符串。如果你知道了,请告诉我。
下面是整个函数的代码:
-- IBOutlets
property theWindow : missing value
property statusMenu : missing value
property partNumberField : missing value
property projectNameField : missing value
on generateButtonClicked:sender
set projectName to projectNameField's stringValue() as text
set partNumber to partNumberField's stringValue() as text
set status to statusMenu's objectValueOfSelectedItem as text
set theSubject to (status & ": " & projectName & ", Part No.: " & partNumber) as string
log (class of theSubject) & ": " & theSubject
tell application "Mail"
try
set newMessage to make new outgoing message with properties {subject: theSubject, theContent: "", visible: true}
on error e
log e
end try
activate
end tell
end generateButtonClicked:发布于 2018-06-12 08:18:20
set newMessage to make new outgoing message ¬
with properties {subject: theSubject, theContent: "", visible: true}theContent不是outgoing message的属性。将其更改为content。
https://stackoverflow.com/questions/50787424
复制相似问题