AppleScript 脚本命令实现
我正在尝试实现一个简单的脚本命令,但没有成功。 我的 sdef 文件
...
<class name="image" plural="images" code="imag" description="Image class">
<cocoa class="MyImage" />
<property name="width" code="wdth" type="real" access="r" description="The width of the image."/>
<property name="height" code="hght" type="real" access="r" description="The height of the image."/>
<responds-to name="rotate">
<cocoa method="scriptingRotate:"/>
</responds-to>
</class>
<command name="rotate" code="frwkrota" description="Rotate the image.">
<direct-parameter type="image"/>
<parameter name="by" code="by " type="real" description="Degrees to rotate.">
<cocoa key="angle"/>
</parameter>
</command>
...
我的字典没问题:图像响应旋转等等。 但
tell application "MyApp"
rotate image 1 by 1
end tell
表示:“预期行尾,但找到了类名。”错误在哪里?
get image 1
工作正常(MyImage 有 objectSpecifier)。
已解决
似乎这是 ScriptEditor 的一个错误。
重新启动 ScriptEditor 解决了问题。
I'm trying to implement a trivial script command, byt have no success..
My sdef file
...
<class name="image" plural="images" code="imag" description="Image class">
<cocoa class="MyImage" />
<property name="width" code="wdth" type="real" access="r" description="The width of the image."/>
<property name="height" code="hght" type="real" access="r" description="The height of the image."/>
<responds-to name="rotate">
<cocoa method="scriptingRotate:"/>
</responds-to>
</class>
<command name="rotate" code="frwkrota" description="Rotate the image.">
<direct-parameter type="image"/>
<parameter name="by" code="by " type="real" description="Degrees to rotate.">
<cocoa key="angle"/>
</parameter>
</command>
...
My dictionary is ok: image responds to rotate and so on..
But
tell application "MyApp"
rotate image 1 by 1
end tell
says that: "Expected end of line but found class name." Where is the mistake?
get image 1
works normally (MyImage have objectSpecifier).
SOLVED
Seems like it was a bug with ScriptEditor..
Restarting ScriptEditor solved the problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论