AppleScript - ObjC: Whats the connection?

Discussion in 'Mac Programming' started by DmbShn41, Jul 12, 2009.

  1. DmbShn41 macrumors 6502

    Jun 22, 2009
    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?
  2. ghayenga macrumors regular

    Jun 18, 2008
    No. There is no connection between them.
  3. -aggie- macrumors P6


    Jun 19, 2009
    Where bunnies are welcome.
    No, you can't use AppleScript in place of ObjC.
  4. kainjow Moderator emeritus


    Jun 15, 2000
    Well not yet at least ;)
  5. larkost macrumors 6502a

    Oct 13, 2007
    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.
  6. mysterytramp macrumors 65816


    Jul 17, 2008
    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.

  7. lee1210 macrumors 68040


    Jan 10, 2005
    Dallas, TX
    You can go the other way with NSAppleScript:

  8. Billy Boo Bob macrumors 6502

    Billy Boo Bob

    Jun 6, 2005
    Dark Side Of The Moon
    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
  9. larkost macrumors 6502a

    Oct 13, 2007
    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").

Share This Page