Slashdot Mirror


AppleScript Updated to 1.8.3

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.

22 comments

  1. Buggy installer of the ugrade by Anonymous Coward · · Score: 2, Informative

    It seems that the Installer is buggy and a lot of people have reported that it crashes on launch!

  2. AppleScript Perl by Anonymous Coward · · Score: 0, Funny

    Slashdot is written in AppleScript, not Perl.

  3. Re:Does anyone care? by ProfKyne · · 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. 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 ) -- 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 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".

    --
    "First you gotta do the truffle shuffle."
  4. Re:Buggy installer of the upgrade by jeffehobbs · · 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

  5. Re:Does anyone care? by Anonymous Coward · · Score: 1, Interesting

    Hi, I'm a Windows user who is buying his first Mac in a month or two (yep, OS X got me hooked, and hopefully I will never have to go back). I currently program in Python and was wondering about AppleScript - how does it compare to Python? 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.

    Thanks for your advice,
    Michael M.

  6. Re:Does anyone care? by g4dget · · Score: 2
    Besides that, AS hooks nicely with scriptable apps on the Mac.

    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.

  7. Re:Does anyone care? by g4dget · · Score: 2
    You get two major flavors of Python. One is comes from Fink and is almost identical to the UNIX/Linux version of Python (including Tkinter, wxPython, Numeric, etc.). Another is tightly integrated with OSX and provides access to Cocoa and a lot of other facilities. For the latter, you also get hooks into OSA (Open Script Architecture), which lets you do pretty much everything from Python you can do from AppleScript. Perl, similarly, comes in two such flavors.

    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.

  8. Just a point by Anonymous Coward · · Score: 0

    this isn't just any point release, there are things going on over in Cupertino right now. the revs are being set into position for the big Jaguar release. There have been more than five updates made available in the past week. this may not sound like a big deal to people that are used to their "minor point releases" being just that, but to a group of people that haven't seen any updates for about 32 days it is slightly important. to those that don't understand too bad, it's a shame that your software is so buggy that it needs to be updated on an hourly basis. to the rest, it is a nice update.

  9. Re:Does anyone care? by Anonymous Coward · · Score: 0

    Sounds good. Where can I find info on the version of Python that provides access to Cocoa?

    And by the way, I also tried the Windows Scripting Host CRAP before. What a lame attempt. Just one more reason I'm getting off the MS Titanic before it goes down completely.

    Thanks muchly,

    Michael

  10. Re:Does anyone care? by jub · · Score: 2, Interesting
    AppleScript is great for little projects that need to tie programs together - you don't want to use it for serious data munging, but it'll do a nice job of building a Quark document, or for quick little utilities.

    Here's a quick list of mini-AppleScripts i use almost every day at work:
    network login window - so i don't have to seperately log in to 3 different servers
    faux-cli - to jump to different directory window (yes, this can be handy, especially when the alternative is drilling through 6 directory layers, when i can more easily type a known path)
    automated backup routine - for email mostly, with iDo script scheduler (this is on OS9, i'd use cron if i used X at work)
    create new folders - creates a numbered series of new folders where i say to
    phone search - gives a quick window to enter a search to our intranet's phone directory (which i wrote in PHP)
    file renaming - batch file renaming (search/replace, add prefix/suffix), just about the only way to do it in OS 9. Some of these are scripts that ship w/the OS
    general batch processing - converting Word files to text, print whole Quark document as single-page pdf files, lots of BBEdit-related scripts (ie, add the filename to the title of an html doc), etc.


    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.
  11. Re:Does anyone care? by Anonymous Coward · · Score: 0

    Sounds good. Where can I find info on the version of Python that provides access to Cocoa?

    If there is one, there's a link to it on http://python.org. I know for sure that there is a Carbon version of Python which works with both OS9 and OSX.

  12. AppleScript is the Best Thing to come out of Apple by Anonymous Coward · · 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!)

  13. Re:Buggy installer of the upgrade by gravygraphics · · Score: 3, Informative
    Readme.rtf

    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.

  14. Re:Does anyone care? by ProfKyne · · 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 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 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.

    --
    "First you gotta do the truffle shuffle."
  15. Create by ek_adam · · Score: 1

    And for another interesting use of Applescript, Stone Create has a Save As option that will create an Applescript that will recreate the entire document. This is very useful if you want to create a script for some very graphic intensive forms. Set up the form with default data, Save As Applescript in Create, and then you have some very minor script editing to replace default data with variables. Very nice if you are not a full time programmer. Somewhat time saving even if you are one.

  16. Re:Does anyone care? by pudge · · Score: 1

    No, there is no OSA Perl, on either Mac OS or Mac OS X. There once was an experiment years ago to have an OSA Perl on Mac OS, but it failed.

    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 ... there's also CamelBones for doing Cocoa with Perl inside of ProjectBuilder, but it still isn't an OSA language.