Re: Trying to create an sdef
Re: Trying to create an sdef
- Subject: Re: Trying to create an sdef
- From: Shane Stanley <email@hidden>
- Date: Thu, 07 Aug 2014 17:22:54 +1000
On 7 Aug 2014, at 4:55 pm, Gerriet M. Denkmann <email@hidden> wrote:
> I have an app (called App) which is NOT document based and has an app delegate called AppDelegate.
>
> Now AppDelegate has a property:
> @property (readonly) NSString *babbel;
> implemented as:
> - (NSString *)babbel { return @"Bibbel"; }
>
> How to write an apple script (to be used in Apple Script Editor) to get this magic Bibbel-string?
> And how to write the sdef to make this possible?
> And what else does my AppDelegate has to implement?
It's easier, if possible, to put -babbel in a category on NSApplication. If you can't, you can implement the delegate method -application:delegateHandlesKey:, but that strikes me as generally more effort.
Then your sdef will say:
<suite name="App Suite" code="Apps" description="Classes just for the App application.">
<class name="application" code="capp" description="The application class.">
<cocoa class="NSApplication"/>
<property name="babbel" code="babB" access="r" type="text" description="magic string" />
</property>
[ any other properties here ]
</class>
</suite>
> tell application "App"
> get babbel of delegate
> end tell
>
> returns:
> error "Can’t get babbel of delegate." number -1728 from «class babB» of «class Dell»
Trying to add a delegate element is only going to complicate things. Your scripting object model doesn't (and usually shouldn't) match your internal object model.
Use the above and your script will simply be:
tell application "App"
set theText to babbel
end tell
> You see, I am absolutely clueless.
Check out Apple's SimpleScripting and SimpleScriptingVerbs sample projects.
--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden