Solved: How to call this Cocoa method from AppleScript?
Solved: How to call this Cocoa method from AppleScript?
- Subject: Solved: How to call this Cocoa method from AppleScript?
- From: Satoshi Matsumoto <email@hidden>
- Date: Mon, 28 Feb 2005 18:14:07 +0900
I found the answer by myself.
Just mix Objective-C code files, which define the methods you want to
execute, into your AppleScript Studio project. Then call own Objective-C
methods using AppleScript "call method."
Thanks,
Satoshi Matsumoto
on 05.2.28 4:53 PM, Satoshi Matsumoto at email@hidden wrote:
> AppleScript Studio provides the "call method" command for calling methods of
> Objective-C objects in an AppleScript Studio application like this....
>
> set fontNames to (call method "availableFonts" of (call method
> "sharedFontManager" of class "NSFontManager"))
>
> Above AppleScript executes:
> NSArray *anArray = [[NSFontManager sharedFontManager] availableFonts];
> and store the result font name array into list variable "fontNames."
>
> Then I want to sort the contents of "fontNames" list.
> In Objective-C, I can sort an array like this.
>
> NSArray *sortedArray =
> [anArray
> sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
>
> I have no idea to express the parameter "@selector(caseInsensitiveCompare:)"
> in the "call method" format.
>
> How to express the above Objective-C method in the "call method" format?
>
> Thanks,
> Satoshi Matsumoto
>
> P.S. It is much more effective and easier for me to write objective-C code
> than AppleScript Studio script.
> -----------------------------------------------------
> Satoshi Matsumoto <email@hidden>
> 816-5 Odake, Odawara, Kanagawa, Japan 256-0802
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
-----------------------------------------------------
Satoshi Matsumoto <email@hidden>
816-5 Odake, Odawara, Kanagawa, Japan 256-0802
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden