AppleScript Updated to 1.8.3 22
Warlock7 writes "Apple has made the 1.8.3 version of AppleScript available. You can get the update through Software Update." It's available for both Mac OS and Mac OS X, though, as usual, a detailed list of changes is hard to find, though some are in the accompanying About AppleScript file. It appears they've fixed bugs with coercing Unicode text (now I can fetch and use text from iTunes via Apple events), and Apple says it provides increased stability of scripts, and runs applications created with the latest version of AppleScript Studio.
Buggy installer of the ugrade (Score:2, Informative)
Re:Buggy installer of the upgrade (Score:4, Interesting)
It seems that the Installer is buggy and a lot of people have reported that it crashes on launch!
...yep, that happened to me too, but interestingly enough, one top -u in the terminal will show you that the actual install continues on. The installer crashed my iBook, but apparently only the Cocoa front end to the install was actually affected. The actual software install went ok, and the requisite update_prebinding post-install "optimization" automatically fired up afterwards as well.
Odd.
~jeff
Re:Buggy installer of the upgrade (Score:3, Informative)
Double click on installer. Please note that the AppleScript Studio front end to the Installer needs AppleScript Update 1.8.3. Running the Installer with a previous version of AppleScript may result in decreased stability of the Install process.
Thank you for using Apple products. Buh-Bye.
Re:Does anyone care? (Score:5, Insightful)
Howsabout some Stuff That Matters? Jeez... at least timothy posts amusingly trollish crap. pudge... well really, does anyone give a fuck about minor point releases of scripting languages used by the three people worldwide who found Python too difficult to get their heads round?
Actually, AppleScript isn't really easier than Python. Even for non-programmers, I would be willing to bet that most people find Python easier to learn and more intuitive -- AppleScript has an "English-like" syntax (as its marketing says), and English is actually one of the most inconsistent and hardest languages to learn (for those who are not raised speaking it). Why? Because there are so many different ways to say the exact same thing in English, not just synonyms but the grammatical structure itself -- very unsystematic. I find that the same thing is true of AppleScript. This is often leveraged against Perl by those who would criticize it as being difficult to learn (in comparison with PHP or Python, for instance).
Whereas Perl and AppleScript provide "more than one way to do it", Tim Peters praises Python saying There should be one-- and preferably only one --obvious way to do it. [mindview.net] Anyone who's written an AppleScript can tell you this is definitely not true of AppleScript.
Besides that, AS hooks nicely with scriptable apps on the Mac. It even lets you call shell scripts and other languages' scripts directly. I don't use AS much, but one of my favorite little tools is a script I incorporated into my text editor ( BBEdit [barebones.com] ) -- I highlight a function name and hit F8, and my web browser pops open and serves me the man page for that function (using php.net's [php.net] awesome URL-based function lookup.
No, none of this really matters for non-Mac users, but then why are you reading apple.slashdot.org if you're not interested? Besides, as you can see from the release number, it's not like AppleScript has been updated much in its 14+ years of existence. For Script-savvy Mac users, this is "news that matters".
Re:Does anyone care? (Score:1, Interesting)
Basically, what I'm asking is: Should I pick up the O'Reilly AppleScript book now, or just stick with Python and Tkinter? Anything you can tell me would be great.
Thanks for your advice,
Michael M.
Re:Does anyone care? (Score:2)
Knowing a little bit of AppleScript may still be useful, but on the whole, I wouldn't bother too much with it.
All of this, incidentally, works a lot better in my opinion than Microsoft's scripting framework.
Re:Does anyone care? (Score:1)
MacPerl allows access to the raw IAC API under Mac OS, including the OSA* and AEGizmos APIs, and can compile and execute raw AppleScript (or any installed OSA language, via the Mac::OSA or Mac::OSA::Simple module), but is not itself an OSA language. On Mac OS X, perl can call out to the osascript and osacompile command line tools
Re:Does anyone care? (Score:2, Interesting)
Here's a quick list of mini-AppleScripts i use almost every day at work:
You get the idea. Sure, lots of these could be done in other languages, but none of them took any time to write. AS is surprisingly powerful for these little uses, and runs very fast. It's a huge time-saver for me.
As for AppleScript Studio, it's a very cool thing, but it does add a level of complexity to the scripts. You're not just writing a little script, you're coding an app and interacting with the user - lots of additional complexity. It would sure make some pretty looking scripts though.
Re:Does anyone care? (Score:2, Interesting)
You've mentioned that it's a bit more difficult to learn, and it's probably not as well designed (my guess), but how's the performance under OS X? I hear AppleScript Studio allows you to compile your scripts into apps. Is this true? What's the Python support like in OS X?
Basically, what I'm asking is: Should I pick up the O'Reilly AppleScript book now, or just stick with Python and Tkinter? Anything you can tell me would be great.
If you currently program in Python, I would only bother with AppleScript for stuff that is difficult to do in Python (or rather, would take more coding). AppleScript is great for writing more-advanced macros -- for instance, an idea I've been toying around with is writing an AppleScript that calls a Perl script to parse a MySQL database dump and create an object in OmniGraffle [omnigroup.com] to represent that in a database diagram. But you can see, even from this example, I would use another language (Perl) to parse the data and then use that to tell the AppleScript how to interact with OmniGraffle and draw the object. If the Perl OSA becomes more mature, I can bypass AppleScript altogether.
Basically, I think it can be useful, esp with AS Studio, to create a "wrapper" script that calls a more advanced script that is written in Perl or Python, unless all you want to do is some basic system stuff. There are AppleScript gurus who will disagree with this, and they are probably geniuses who can make AS do what they want -- but I prefer the more pithy (hah a pun) syntax of Python to the sentences of AppleScript.
Python support in OS X -- well, OS X is Unix, so you just grab the source and compile it (it's a piece of cake) and now you have Python. Since OS X does not have the Tk or certain other windowing toolkits built-in, you should probably use Fink [sourceforge.net] to install X11 onto your Mac and then you can use the Tk toolkits (and other graphical toolkits like Gtk and that TrollTech one I forget what it's called) to build GUI apps. Of course, I think that it's supposed to be relatively easy to build a Cocoa wrapper around a Perl script in the next version of OS X (10.2), so perhaps a Python one will be forthcoming as well.
To answer your final question, I purchased that book but it was written in OS X's infancy (10.0.x) and barely covers OS X. I'd wait for a new edition for that one, since really AS is not very different between OS9 and OS X. But that book has a lot more content for applications that exist in OS 9.
Re:Does anyone care? (Score:2)
That's simply OSA (Open Script Architecture). You can do the same thing from any other scripting language that knows about OSA, like, for example, Python and Perl.
I find that the same thing is true of AppleScript.
I also think that AppleScript is perhaps OK for very small scripts, but for any serious scripting, people are better off with Python (or Basic, for that matter). It's similar to COBOL or Ada: adding more English words to a programming language doesn't make programs easier to read or write, it just makes them longer.
Again, fortunately, OSA lets you use your preferred scripting language.
Create (Score:1)
AppleScript is the Best Thing to come out of Apple (Score:4, Funny)
Apple's AppleScript and AppleScript Studio are powerful programming tools; they give me the power to write programs, utilities, and scripts that would otherwise take considerable skill, time, energy, experience, and effort. Apple has done it once again with this editor and language that allow me to eschew the traditional route to writing programs.
The greatest thing about AppleScript and ASS is the ability to compile the scripts into actual machine code. Though it does take away the ability to edit the script on the fly, it saves about 2x the space (thanks to dynamic libraries) and increases speed upwards of 10x (thanks to AltiVc optimizations). This is far more powerful and advantageous than VBScript in Windows or REXX in OS/2. And since AppleScript can even integrate with Perl and shell scripts, it has edges no other OS or scripting language has. It was these awesome features that allowed me to delve into a project never before thought possible, thanks to Apple and Mac.
Being a student of Computer Science, I had just taken OS Fundamentals, an upper-division class that covered the lowest levels of an OS. We looked at the Linux, FreeBSD, QNX, and Mac OS X/Darwin's Mach kernels. Being a Mac user, I was especially interested in Mach and began reading about its history at Carnegie Melon under Avie Tevanian (now Apple's head of Software Engineering). It had also been used as the basis of many other operating systems, such as Apple's abortive MkLinux, IBM's still-born OS/2-for-PowerPC, and the under-developed GNU HURD.
Wondering how I could overcome the inherent slowness in the design of Apple's heavily-modified Mach, I began researching on how it was designed. Apple's OS team, like any other software engineering project, had made a few trade-offs: strip out functionality to make hardware-to-software messaging from the upper OS levels lightning fast, or keep a lot of features in and push more of the OS's functionality toward the faster, lower run-levels. Wanting to further understand the fundamentals of Apple's Mach, I took to rewriting bits and pieces of it in ways I understood.
But C was a nightmare for me-- as a Mac user, I was used to something a little friendlier. Quite frankly, C was a textual hive of demon spaghetti worming through my head with no semblance of order or efficiency. I needed to do this in a way I understood, in a language that I could deal with. And that is where AppleScript came in. I started up AppleScript Studio after downloading the December Developer's CD. After getting into ASS I never looked back at GCC or Pico ever again.
My first tries at getting a running my Mach kernel failed miserably but I learned quickly from my mistakes. The first few runnable versions were abysmally slow, worse even than OS X itself, and I almost gave up the project then. But after compiling my code, things picked up ten-fold. With the speed problem hurdled, I set about tweaking my AppleScript code for talking to the hardware. This is where knowing how to use Apple's Vector Engine libs and Motorola's AltiVec calls came in handy, and before I knew it I had something that ran considerable faster than the native kernel it was being developed on!
In less than a month, I had a fully-working, optimized Mach kernel written in AppleScript thanks to Apple's ASS. The moment of truth came when I replaced the regular, default Mach kernel with my own. Sweating, my breath coming in short gasps, I could barely stand the anxiety as my Power Mac 8600 rebooted... successfully! All thanks to Apple's wonderful scripting technology that is so much more than what it appears to be :)
Now, I work at Apple on the OS Engineering team thanks to my low-level tinkering experience. I graduate college soon with a Master's degree in Computer Science. The experience offered to me by Apple's tools and technologies have allowed me to be where I am today, re-working vital bits of Darwin with AppleScript and enhancing the wonderful language itself (look for my name in the next AppleScript update you download!)