I'm listening to
All Nightmare Long by Metallica



##

#

APPLEcationsAPPLEcations
Why I prefer Applescript
Posted on: 04-25-2008

Applescript. What is it? It is a programming language that grew out of the HyperCard project back in the early 90's. It's unique verbatim-style makes the learning curve small and simple.

It was introducted in October 1993 as part of System 7 Pro (We're running system 10 now, aka OS X) and was designed to simplify and automate workflows.

These days, well, it's used to simplify and automate workflows. But there is one very distinct difference: Applescript Studio.

Apple had really put some meat on Applescripts metaphorical bones and finally decided to let it spread it's wings and fly. They created a unique connection to allow you to create your own Cocoa-based GUI applications that operate under the command of Applescript.

Considering the almost speakable languages abilities and integration with OS X, this move proved that Applescript was a lot more than what it appeared.

Let me give you a very simple command. First, I'm going to type it out as if I were talking. The second line is how you would write in in actual code.

Line 1 (Speaking)

if the object's name equals 3, then do something


Line 2 (Applescript)

if theObject's name equals "3", then -- do something


With a language this easy to learn, it made it easy for developers to create top-notch applications to complete simple, every day tasks. Developers are creating libraries (mini-SDK's) for their applications to allow Applescripters to write their own applications that can interact with them.

These aren't small, no-name programmers either. We're talking Quark, Adobe, and many others.

Applescript can also interact with the shell (command line) which means anything you can do via command line, you can do via Applescript and even slap a pretty GUI on it.

With all that said, it certainly has a few limitations. For me, one of the most irritating is the fact that it is nearly impossible for Applescript to use multi-threading. Since it renders the code like we read a book, once it starts a command, you can't stop it until it's done (other than a Force Quit). This also causes progression problems when doing a large file transfer. You are unable to show the files being transferred, nor their progress.

There are other limitations, but not one that I haven't been able to overcome with a little creative thinking to work around it.

I have spent about a year off-and-on learning Applescript, MySQL, PHP, and polishing a few other skills. I continue going back to Xcode and my Applescript.

My dock is filling up with these great little utilities I create and use to transfer and sync files & folders, notify myself when something has been added to any of my MySQL databases, alert me when forms on my site have been used, ping 8 servers at once, create drag-and-drop application to alert someone of breaking news, launch and/or quit another application depending on the current time, executing quick-fix bug-fix for Adobe InDesign, even posting this article on my website was done through Applescript.

It's an extremely powerful tool that some programmers ignore because 'How functional can it be if you can nearly speak it?'

I say 'How functional can I make it be BECAUSE you can nearly speak it?'

There are no pictures associated with this post.


Got something to say? Please be polite! (Rules)
Name
Message
Answer this simple math question. (Why?)