Re: AppleScript in 10.9
Re: AppleScript in 10.9
- Subject: Re: AppleScript in 10.9
- From: Alex Hall <email@hidden>
- Date: Tue, 22 Oct 2013 20:35:41 -0400
So, are there any limitations? Such as, can only installed frameworks be used, or can any objc library work? Sorry, I don't have the link for the documentation you sent, and the Safari update did odd things to my opened tabs...
On Oct 22, 2013, at 8:29 PM, Shane Stanley <email@hidden> wrote:
> On 23 Oct 2013, at 11:18 AM, Alex Hall <email@hidden> wrote:
>
>> So, if I'm reading this right, we can use ObjC in AS files, or at least call ObjC library functions? Did I seriously just read that?
>
> Yes, you read that right. Here's a simple example. In AppleScript Editor, enter this:
>
> use framework "Foundation"
>
> on sortAList:aList
> set anArray to current application's NSArray's arrayWithArray:aList
> return (anArray's sortedArrayUsingSelector:"compare:") as list
> end sortAList:
>
> Save it as a .scptd file to ~/Library/Script Libraries/ (you will have to create the folder). Then click on the Bundle Contents button in the script window's toolbar, and check next to AppleScript/Objective-C Library. Save.
>
> Now open another script window and then enter this, changing the name to that of the library you just saved (minus the extension):
>
> use theLib : script "<script name here>"
>
> set theResult to theLib's sortAList:{2, 8, 3, 9, 4, 0, 1}
>
>
> --
> Shane Stanley <email@hidden>
> <www.macosxautomation.com/applescript/apps/>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
Have a great day,
Alex (msg sent from Mac Mini)
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden