&引用;告诉应用程序';邮寄'&引用;韩元';在AppleScript ObjC应用程序中不接受来自IBOutlet的字符串

&引用;告诉应用程序';邮寄'&引用;韩元';在AppleScript ObjC应用程序中不接受来自IBOutlet的字符串,applescript,applescript-objc,Applescript,Applescript Objc,我正在开发一个AppleScript ObjC应用程序,它可以在邮件中生成电子邮件。我的UI有三个IBoutlet(两个文本字段和一个弹出菜单),用户可以在其中输入将填入电子邮件的文本。我可以将这些输出的值保存到变量中,但当我尝试在我的tell应用程序“Mail”语句中使用这些变量时,我会遇到以下错误: AppleEvents:收到mach消息,该消息不是预期的复杂类型 在getMemoryReference中 下面是日志中打印的内容: ( "<NSAppleEventDescri

我正在开发一个AppleScript ObjC应用程序,它可以在邮件中生成电子邮件。我的UI有三个IBoutlet(两个文本字段和一个弹出菜单),用户可以在其中输入将填入电子邮件的文本。我可以将这些输出的值保存到变量中,但当我尝试在我的tell应用程序“Mail”语句中使用这些变量时,我会遇到以下错误:

AppleEvents:收到mach消息,该消息不是预期的复杂类型 在getMemoryReference中

下面是日志中打印的内容:

(
    "<NSAppleEventDescriptor: 'ctxt'>",
    ": ",
    "Status: MyProjectName, Part No.: 12345"
)

内容
不是传出消息的属性。将其更改为
content

到目前为止,您的脚本还不错。该错误基于最新Xcode(9.x)中的错误。这是无害的,苹果已经知道了。该类也很好,因为这些值会自动桥接到Apple事件。脚本是否符合您的要求?然后,当我为主题、内容等硬编码字符串时,你的技巧我尝试生成一条新消息,但当我尝试输入变量(主题、内容)时,它不起作用,并给出我上面引用的错误。
-- 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:
set newMessage to make new outgoing message ¬
    with properties {subject: theSubject, theContent: "", visible: true}