views:

260

answers:

6

Is there any other scripting language that can be used to embed scripts inside applications, which can access Mac OS X, or application classes with the same features, or most of the features seen in F-script?

+6  A: 

The scripting language with the best support on the Mac is still AppleScript. But unlike F-Script, it cannot directly access the Objective-C level, it can only use what the target application chooses to expose for scripting.

There are Objective-C bridges for Perl, Python, and Ruby. I suppose those can embedded to provide scripting to your application.

Thilo
AppleScript requires more work to be done to integrate it with the application, but after that work has been done, the application can be piloted from any external script, not only from scripts executed from inside the application. At the end, Applescript seems the better solution.
kiamlaluno
Note also that AppleScript can now access Objective-C, via a less-known mechanism called AppleScriptObjC, see http://developer.apple.com/mac/library/releasenotes/ScriptingAutomation/RN-AppleScriptObjC/index.html. I'm afraid it might be discontinued in the next XCode, though ...
Yuji
+3  A: 

Nu is an interesting option, although it isn't very popular yet.

Frank Schmitt
Nu is interesting, it has some features that I didn't find in F-script, but it doesn't support the garbage collection. The documentation is not complete, and this doesn't help.
kiamlaluno
+3  A: 

A lot of people seem to like JSTalk.

But probably Applescript is your best bet: integrated into the system and all that.

RyanWilcox
+3  A: 

I would say F-Script for many reasons. It has many unique features and is extremely tightly integrated with Cocoa and the Objective-C runtime. You can for example inspect various Finder classes (windows, icons, coverflow view...) and it's very easy (one or two lines of code) to start or control other processes. I don't think there is any good reason to prefer AppleScript. It's good for very short scripts, but will probably drive you crazy if you want to do something more complex.

Also, MacRuby is going to rock when it's a bit more stable, and some serious stuff has been accomplished using PyObjC as well, although I don't think it's very actively maintained anymore.

Felixyz
+1  A: 

If you don't need F-Script graphical introspection tools, which are quite unique, there are some decent scripting languages that you can embed in applications. See in Particular RubyCocoa (for Ruby), PyObjC (for Python), JSTalk (for JavaScript) and CamelBones (for Perl). They are based on bridges between Cocoa and a foreign object model, which leads to some complexities. This is different from F-Script, which is directly built for the Cocoa object model. When ready, MacRuby might be an option too, but the syntax for manipulating Objective-C objects is not very nice (it improves on RubyCocoa, though). Nu is also an option: directly built for Cocoa like F-Script, but with a strong Lisp flavor.

A: 

MacRuby is an implementation of Ruby 1.9 that uses the Objective-C runtime and garbage collector. It can be embedded in a Objective-C application. Even if the last available version is only 0.6, it is reported to be stable enough to be used in applications.

kiamlaluno