Xcode 支持将AppleScriptObjC变量共享到标签对象

Xcode 支持将AppleScriptObjC变量共享到标签对象,xcode,applescript,applescript-objc,Xcode,Applescript,Applescript Objc,这是我在AppleScriptObjC中开发的一个应用程序示例。我用不同的字符串替换了很多东西,但这是基本的布局 如何将“testVariable”的值获取到“displayLabel”属性中,该属性链接到interface builder中的标签?标签最初是空的,但我希望在脚本运行后用“testVariable”的值填充它 谢谢 语法与ObjC语法非常相似 ObjC script AppDelegate property theWindow : missing va

这是我在AppleScriptObjC中开发的一个应用程序示例。我用不同的字符串替换了很多东西,但这是基本的布局

如何将“testVariable”的值获取到“displayLabel”属性中,该属性链接到interface builder中的标签?标签最初是空的,但我希望在脚本运行后用“testVariable”的值填充它


谢谢

语法与ObjC语法非常相似

ObjC

   script AppDelegate  

        property theWindow : missing value
        property displayLabel : missing value

            on applicationWillFinishLaunching:aNotification

                    display dialog "Are you ready?" buttons {"Yes", "No"} default button "Yes"

            end applicationWillFinishLaunching:

            if result = {button returned:"No"} then

                display alert "That's a shame."

                tell application "This Application"
                    quit
                end tell

            else if result = {button returned:"Yes"} then

                set testVariable to "this is a test"

            end if

    end script
AppleScriptObjC

displayLabel.stringValue = testVariable;

谢谢瓦迪安!这是一个很大的帮助。我想问一个后续问题,如果可以的话,瓦迪安;在我展示的示例代码中,只要打开应用程序,主应用程序窗口就会显示在对话框后面,并且是空白的。在选择相应的对话框并填充标签之前,是否有方法隐藏此主应用程序窗口?谢谢在Interface Builder中隐藏窗口在启动时取消选择可见,并使用NSWindow的MakeKeyandDerfront:方法以编程方式显示窗口
set displayLabel's stringValue to testVariable