1
我有一個測試AppleScript字典:腳本Cocoa應用程序
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd">
<dictionary title="ScriptTest Terminology">
<suite name="Standard Suite" code="????" description="Common classes and commands for all applications.">
<class name="application" code="capp" description="The application's top-level scripting object.">
<cocoa class="NSApplication"/>
</class>
</suite>
<suite name="MyApplication Suite" code="scts" description="MyApplication information.">
<class name="application" code="capp" description="The application's top-level scripting object." inherits="application">
<cocoa class="NSApplication"/>
<responds-to command="sayhello">
<cocoa method="sayHello:"/>
</responds-to>
</class>
<command name="sayhello" code="sctshell" description="Says hello.">
</command>
</suite>
</dictionary>
我的AppDelegate有方法:
- (void)sayHello:(NSScriptCommand*)scriptCommand;
但它永遠不會被調用。爲什麼?
如何在appleScript中將命令添加到我的應用程序類中? (例如tell application "Test" to sayhello
)?