05.01.2013 Views

Mac OS X Leopard - ARCAism

Mac OS X Leopard - ARCAism

Mac OS X Leopard - ARCAism

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 24 MAC <strong>OS</strong> X DEVELOPMENT: THE APPLICATION FRAMEWORKS 435<br />

thumbnail, the preview can be nearly anything. Your preview might be your entire document as<br />

a PDF, or perhaps a QuickTime movie of your application in action. You can even generate<br />

dynamic content on the fly.<br />

Quick Look is a good chance for your documents to shine, but if you do not provide a preview,<br />

users will get disappointing generic icons, like the white document icons to the right of<br />

center in Figure 24-13. Not only is Quick Look used in the Finder’s column and Cover Flow<br />

views, it can also be activated by users directly.<br />

Figure 24-13. Spotlight’s smart folders in the Finder, enhanced by Quick Look and Cover Flow<br />

Scripting Bridge<br />

The best way to integrate with other applications is through an official API, but when that nicety<br />

is not afforded to you, you can always use AppleScript. As discussed in the last chapter, Apple-<br />

Script is the high-level language users can use to make applications do their bidding.<br />

Unfortunately, AppleScript is not particularly fast. Using it in your application, while certainly<br />

possible, requires you to shift your brain mid-project into another language. When<br />

performance is a factor, developers have traditionally turned to Apple Events, the low-level system<br />

that lets AppleScript work its magic.<br />

Somewhere on Earth I’m sure someone understands Apple Events, but by now you should<br />

know Cocoa programmers hate resorting to low-level programming. Apple, in its inimitable<br />

way, has simultaneously solved all these problems at once with <strong>Leopard</strong>’s new Scripting Bridge.<br />

Using Scripting Bridge is so easy it almost defies explanation:<br />

1. Run the command-line tools sdef and sdp to generate Objective-C headers from another<br />

application’s AppleScript dictionary.<br />

2. Include the generated headers in your project.<br />

3. There is no step 3.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!