0

好的。所以,让我们说:

  • 我有一个类myCollection、一个类myObject和一个属性objectsmyCollection返回一个NSArrayof myObjects

鉴于我已经为和类正确设置了我的.sdef文件,我应该如何在那里定义我的属性?myCollectionmyObjectobjects

我的意思是,到目前为止,我可以做这样的事情:

tell application "myApplication"
     collection's activeObject's name
end tell

我想要的是能够访问myObjects 作为数组的元素:

tell application "myApplication"
     set Obj to collection's object 0
end tell

到目前为止,这是我的 .sdef(几乎......):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd">
<dictionary xmlns:xi="http://www.w3.org/2003/XInclude">
    <xi:include href="file:///System/Library/ScriptingDefinitions/CocoaStandard.sdef" xpointer="xpointer(/dictionary/suite)"/>
    <suite name="myApplication Suite" code="myRm" description="myApplication Suite">
        <class name="application" code="camy" description="myApplication&apos;s top-level scripting object." inherits="application">
            <cocoa class="myApplication"/>
            <property name="myname" code="PEnm" description="The name of the application" type="text" access="r">
                <cocoa key="myname"/>
            </property>
            <property name="currentContents" code="PEnc" description="The current contents" type="text" access="r">
                <cocoa name="currentContents" />
            </property>
            <property name="activeDocument" code="PEad" description="The active document" type="document" access="r">
                <cocoa name="activeDocument" />
            </property>
        </class>
        <class name="document" code="cDoc" description="myApplication document">
            <cocoa class="myDocument"/>
            <property name="alias" code="cDal" description="The document's alias" type="text" access="r">
                <cocoa key="alias" />
            </property>
            <property name="content" code="cDco" description="The document's content" type="text" access="rw">
                <cocoa key="content" />
            </property>
        </class>
    </suite>

</dictionary>

我该怎么做呢?

4

1 回答 1

0

这就是我所需要的:

    <class name="editor" code="cDed" description="myEditor">
        <cocoa class="myEditor"/>
        <element type="document" access="r">
            <cocoa name="documents" />
        </element>
    </class>
    <class name="document" code="cDoc" description="myDocument">
        <cocoa class="myDocument"/>
        ....
于 2012-04-07T12:45:02.247 回答