Section 15.1. What Is AppleScript Studio?


15.1. What Is AppleScript Studio?

Contrary to popular opinion, AppleScript Studio is not a chic art gallery tucked away in Building 5 of Apple's campus in Cupertino. Instead, it's the name Apple gave to the integration of two programsXcode and Interface Builderwith AppleScript. When you use AppleScript Studio, you design your program's look and feel in Interface Builder and write the AppleScript code that makes the program tick in Xcode. By the time you're done, you've got a slick-looking Mac OS X program, coded entirely with AppleScript.

Now, this arrangement might seem pretty ridiculous to a seasoned programmerafter all, AppleScript is one of the slowest programming languages around. Still, if you're coming from the world of simple AppleScripts, there are plenty of good reasons to write your programs in AppleScript Studio:

  • You already know the language! There's no need to spend time learning Cocoa, Carbon, or any of Apple's other geeky programming technologies.

  • You can split your code into multiple scripts. You could have one script that handles button presses, for example, and a separate script that handles menu clicks. This arrangement makes it much easier to keep your code organized, since you can customize each script for a specific task.

  • You have total control of your program's interface. With normal AppleScripts, you can display three-button dialog boxesand that's about it. But when you use AppleScript Studio, your programs can display all the interface elements you'd see in a professional program, including pop-up menus, text boxes, tables, QuickTime movies, and more.

  • You can mix more advanced programming languages into your AppleScripts if you have to. That means that, unlike normal scripts, AppleScript Studio programs can handle complex networking tasks, display Web pages, and perform other tasks normally reserved for Java or C++.

If you want to do advanced programming jobs, you'll still have to use a more advanced programming language. The difference, if you use AppleScript Studio, is that you won't have to write your entire program in a more complicated language; you can simply write the tough parts in another language and continue to use AppleScript for the basic programming jobs.

  • It's easy to write working programs quickly. Since you already know AppleScriptand you create a program's interface with drag-and-dropyou can make a simple, working program in less than an hour. That's why some people use AppleScript Studio for prototyping their programscreating programs with AppleScript Studio to prove that they work, and then reprogramming them in a more advanced language later to improve their speed.

On the other hand, you don't always need all the power that AppleScript Studio offers. For instance, if you just want to create a script that launches TextEdit, AppleScript Studio is overkill. There are other disadvantages to AppleScript Studio programs, too:

  • They take longer to start up than normal scripts. Since AppleScript Studio projects are full-fledged programs, Mac OS X has to load all their interface elements, Dock icons, and menu bar commands before you can run any of the AppleScript code. (Normal AppleScripts don't have this problem, because they can't have interface elements, Dock icons, or menu bar commands.)

  • Programs you create with AppleScript Studio can't be used as folder actions or Mail rules. Again, that's because AppleScript Studio creates programs, not scripts.

You can still use AppleScript Studio programs in the Script Menu (Section 1.1.16.1).

  • AppleScript Studio programs only work in Mac OS X. In fact, they work only in Mac OS 10.1.2 or later. Linux and Windows fans (and even people who use earlier versions of the Mac OS) are left out in the cold.

  • Your code is there for the whole world to see. Unlike programs written in C, C++, or Java, AppleScript Studio programs don't hide your code very well. That means that sneaky Mac fans can crack your program open, examine your code, and copy it into their own programs, if they so desire. (This is one of the reasons you won't find many commercial Mac programs written in AppleScript Studio.)

If, on balance, AppleScript Studio fits your program-writing needs, read on. Otherwise, see Power Users' Clinic Other Languages for alternativealbeit more complicatedprogramming tools that may do what you want.



AppleScript. The Missing Manual
AppleScript: The Missing Manual
ISBN: 0596008503
EAN: 2147483647
Year: 2003
Pages: 150

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net