Python 如何使我的PyObjC应用程序可写
我想用Python在OSX上创建一个应用程序,它是可AppleScript的 首先,我创建了一个应用程序(它可以工作!)。然后我使用添加AppleScript支持;我试图将Objective-C内容翻译成Python。我在setup.py中的选项中添加了一个plist项:Python 如何使我的PyObjC应用程序可写,python,python-3.x,applescript,pyobjc,Python,Python 3.x,Applescript,Pyobjc,我想用Python在OSX上创建一个应用程序,它是可AppleScript的 首先,我创建了一个应用程序(它可以工作!)。然后我使用添加AppleScript支持;我试图将Objective-C内容翻译成Python。我在setup.py中的选项中添加了一个plist项: OPTIONS = { #... 'plist': { 'NSAppleScriptEnabled': True, 'OSAScriptingDefinition': 'Simp
OPTIONS = {
#...
'plist': {
'NSAppleScriptEnabled': True,
'OSAScriptingDefinition': 'SimpleXibDemo.sdef',
#...
}
}
我创建了SimpleXibDemo.sdef
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd">
<dictionary title="SimpleXibDemo">
<suite name="SimpleXibDemo Suite" code="SXiD" description="SimpleXibDemo Scripts">
<command name="increase" code="increxib" description="Increase the value">
<cocoa class="SimpleXibDemoIncreaseCommand"/>
<parameter name="by" type="integer" optional="yes">
<cocoa key="by"/>
</parameter>
<result description="Returns the new value" type="integer"/>
</command>
</suite>
</dictionary>
应用程序本身可以工作,但当我运行此AppleScript时:
tell application "SimpleXibDemo"
set myResult to increase by 3
end tell
我得到这个错误:
error "SimpleXibDemo got an error: Can’t continue increase." number -1708
我找不到关于错误号1708的任何信息。当我用scripteditor->opendictionary打开应用程序时,什么也没发生
这里有什么问题?我有点卡住了:-/
error "SimpleXibDemo got an error: Can’t continue increase." number -1708