Satimage Previous
Controlling external codes
Home Documentation SmileLab Controlling external codes  
An interactive graphic displaying results of an external program.
Controlling an external code consists in interacting with it. For instance, you can simply launch a UNIX executable with a shell command. AppleScript provides much more power, since you can control an application while it is running (application is Apple's term for process). Under MacOS X, most of the applications are "scriptable", so tasks involving those applications may be automated.

Using the sample projects supplied with Smile, you can make your own computational program into a scriptable application. All you need is to include in your C, C++, or FORTRAN project a few files which will subscribe (or, "publish") your application to AppleScript - your original code remains untouched. You will also attach to your program its AppleScript dictionary, which is where you define the syntax to use when "talking" to your program.

A script uses specific terms (in green) to control a given external application.

You will derive several benefits from making your program scriptable.
  • AppleScript replaces the high-level languages such as Python which are used when rapidly developing a solution.
    The computing program's core has to use a compiled language for optimal speed, performance, and portability. The rest: interacting with the computation, handling the interfaces (files, I/O, pre-process of data, etc.), you program in an interpreted language, easier and faster to use. You focus on the computation itself, not wasting time with the peripheral tasks required to have it run, making a user interface, automating a sequence of tests, or initializing values.

  • In addition to interfacing it and visualizing its data, Smile interacts with your program.
    In other words, instead of a master/slave system where you launch computations, then wait until they complete (and dump their data) before taking new actions, AppleScript lets you communicate at any moment and to any extent with the programs. For instance, you read variables belonging to your program, you display them and you can reset or change their values while your code is running. Furthermore Smile can remain up and running while you are bringing changes to your program, when you develop.
Not only does Smile provide an easy language to implement all the tasks required to serve the computing code, it also installs a full real-time interaction between the user and the computation. This new kind of communication with the computation makes still more sense when used in conjunction with the various user interaction channels that Smile makes available, and since it is so easy to develop and augment a project in Smile.
Copyright ©2008 Paris, Satimage