gpt4 book ai didi

XCode/AppleScriptObjC 新手

转载 作者:行者123 更新时间:2023-12-04 20:03:14 28 4
gpt4 key购买 nike

我是 Xcode 4.4 和 AppleScriptObjC 世界的新手。我正在尝试扩展和试验 Sanderson 和 Rosenthal 所著的“学习 AppleScript”一书中关于 AppleScriptObjC 的教程,但我遇到了一个问题。代码:

property parent : class "NSObject"
property textField : missing value

on buttonClick_(sender)
set theText to textField's stringValue()
set dialogText to text returned of (display dialog "Here is the text your entered: " & return & theText default answer "")
textfield's setStringValue_(dialogText)
end buttonClick

运行完美,我得到了预期的对话框,一切正常。但是,如果我试图弄乱它并添加这两行(当然是在适当的地方):

property anotherTextField : missing value
...
set theText to textField's stringValue() & otherTextField's stringValue()

程序仍然运行 - 但是! - 如果我转到 MainMenu.xib 并按住 ctrl 键单击 AppDelegate 以获取 outlets inspector ... anotherTextField 没有 Outlet,尽管应该有。

有什么想法吗?

最佳答案

我也是 AppleScript 的新手,我遇到的一个常见问题是我首先在 applicationWillFinishLaunching 部分声明了属性。检查一下。如果它仍然不起作用(你确实提到你在适当的地方添加了代码)然后尝试将第二个文本字段的属性声明放在​​“属性父”部分之前。我想可能有用……

尝试发布您的 AppDelegate.applescript 的完整代码

祝你好运!

关于XCode/AppleScriptObjC 新手,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12238208/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com