PDA

View Full Version : AppleScript - ObjC: Whats the connection?




DmbShn41
Jul 12, 2009, 11:37 AM
What is the connection between AppleScript and ObjC? I know you can use Xcode to write AppleScript, and it's ability is underrated. IS it possible to use AppleScript in place of ObjC, similiar to Lua or other languages?



ghayenga
Jul 12, 2009, 12:50 PM
What is the connection between AppleScript and ObjC? I know you can use Xcode to write AppleScript, and it's ability is underrated. IS it possible to use AppleScript in place of ObjC, similiar to Lua or other languages?

No. There is no connection between them.

-aggie-
Jul 12, 2009, 12:56 PM
What is the connection between AppleScript and ObjC? I know you can use Xcode to write AppleScript, and it's ability is underrated. IS it possible to use AppleScript in place of ObjC, similiar to Lua or other languages?

No, you can't use AppleScript in place of ObjC.

kainjow
Jul 12, 2009, 01:04 PM
No. There is no connection between them.

No, you can't use AppleScript in place of ObjC.

Well not yet at least ;)

larkost
Jul 12, 2009, 01:28 PM
You can use XCode to create AppleScript Studio applications where your code is mostly in AppleScript, and you can access Obj-C code from within that script if you are willing to work at it (I did so a long time ago, but don't remember the details). Your GUI is constructed in InterfaceBuilder, almost exactly like a Obj-C project (but you don't bind it the same way).

And then there is the relatively new method of putting an AppleScript interpreter inside Obj-C, but that is more useful for interfacing with other programs through their AppleEvents handles (what AppleScript uses).

And then there are the other scripting bridges such as the ones for Python and Ruby. There you can use modules in those languages to more directly substitute for Obj-C, so long as you use the appropriate XCode template (it has some Obj-C code to set things in motion). You make and bind your GUI in the exact same way as for Obj-C (especially if you use bindings), and you can mix-and-match Obj-C and the template language very easily (although you can't use more than one language + Obj-C).

The AppleScript bridge is not quite as good as the Ruby and Python bridges. It is a bit older, but there was some talk out of Apple engineers at WWDC a year ago about that bridge being brought in line with the others, but I did not make it to this years conference to hear the latest status on that.

mysterytramp
Jul 12, 2009, 09:15 PM
What is the connection between AppleScript and ObjC? I know you can use Xcode to write AppleScript, and it's ability is underrated. IS it possible to use AppleScript in place of ObjC, similiar to Lua or other languages?

Inside Xcode, you can call Cocoa methods using "call method," which gives you quite a bit of functionality. It's not the same as Objective C, but it is a huge leap forward. Google Applescript and "call method" and you should see quite a bit, including entries in Apple lists that will help.

mt

lee1210
Jul 12, 2009, 09:21 PM
Inside Xcode, you can call Cocoa methods using "call method," which gives you quite a bit of functionality. It's not the same as Objective C, but it is a huge leap forward. Google Applescript and "call method" and you should see quite a bit, including entries in Apple lists that will help.

mt

You can go the other way with NSAppleScript:
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSAppleScript_Class/Reference/Reference.html

-Lee

Billy Boo Bob
Jul 13, 2009, 03:26 AM
The AppleScript bridge is not quite as good as the Ruby and Python bridges. It is a bit older, but there was some talk out of Apple engineers at WWDC a year ago about that bridge being brought in line with the others, but I did not make it to this years conference to hear the latest status on that.

It looks like they're going to make it happen with Snow Leopard. Right now AppleScript Studio is totally left out of SL's Dev Tools, and the AppleScript bridge appears to be there (at least partially?), but the docs are not accessible unless you're a qualified dev (to download them).

So I've been told. :D

larkost
Jul 13, 2009, 01:17 PM
It looks like they're going to make it happen with Snow Leopard. Right now AppleScript Studio is totally left out of SL's Dev Tools, and the AppleScript bridge appears to be there (at least partially?), but the docs are not accessible unless you're a qualified dev (to download them).

So I've been told. :D

I can tell you that you have been told wrong, but can't say how (sorry, NDA). I am still missing the information that is important to me, but I can't get that either (someone else told me: "sorry, NDA").