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中工作的应用程序的一个示例。我花了很多钱用不同的字符串替换了东西,但这是基本的布局。
如何获得' testVariable'的价值?进入' displayLabel' property,链接到接口构建器中的标签?标签最初是空的,但我想要' testVariable'脚本运行后填充它。
感谢!!!
答案 0 :(得分:0)
语法与ObjC语法
非常相似ObjC
displayLabel.stringValue = testVariable;
AppleScriptObjC
set displayLabel's stringValue to testVariable