Slashdot Mirror


Apple Previews New Script Editor

DrC writes "Apple has released a preview update to the venerable Script Editor, rewritten using Cocoa. It looks like an impressive upgrade." The preview release is included with the Dec 2002 Developer Tools as a separate install, too.

21 comments

  1. Re:The editor? by brotherash · · Score: 2, Informative

    Why do we need a "replacement" for Perl? Why not let AppleScript do what it is good for and let Perl do the heavy lifting?

  2. Advantages of AppleScript over sh, awk, sed, etc? by rmlane · · Score: 3, Interesting

    I'm a Unix -> OS X switcher, I can script in sh, awk, expect, etc. What advantages are there to learning AppleScript? Is the GUI integration anything like expectk?

  3. Re:Advantages of AppleScript over sh, awk, sed, et by xmath · · Score: 5, Informative
    AppleScript is a scripting language layered on top of AppleEvents, which is basically an object-oriented IPC system. This means that if an application properly supports appleevents, then you can fully control an application via applescript, rather than programatically frob the UI.

    For example, it's valid to say:

    tell application "Finder" to duplicate the selection to folder "Foo" of home

    if you run this, it'll copy whatever you have selected in the Finder to ~/Foo

    The downside is that you have to rely on the developer of the application you want to control to have created the proper hooks.

  4. Re:Advantages of AppleScript over sh, awk, sed, et by xmath · · Score: 5, Informative

    Oh, and another reason is that there are various applications with good AppleScript integration, notable the Finder. For example, you can create "Folder actions", which are scripts that are automatically executed when you open a folder, or drag something into it etc.

    One more thing I should note is that the underlying system (OSA) is quite flexible. In particular, an applications "dictionary" (which contains a description of all objects reachable via IPC and their properties etc) is fairly language-agnostic. It's for example probably possible to write a perl OSA-plugin, which would allow the user to use the Script Editor to write an run perl scripts to control applications via AppleEvents. In fact, if the plugin has handlers for converting AEs to script, the user can "record" scripts. (the system intercepts AEs caused by manual user actions, and translates them into script. pretty cool)

    So there's more to AppleScript than meets the eye. See also Inside Macintosh: InterApplication Communication and other AE/AS/OSA related docs.

  5. Re:The editor? by Slur · · Score: 5, Informative

    AppleScript itself is being constantly updated, as you would know had you read the release notes for the latest OS upgrade. Meanwhile, perl is included with the operating system and there are two different perl-Aqua bridging technologies currently under development, one by Apple and another by an independent effort. And if you look further you will discover that you can call perl / shell scripts from AppleScript, and you can invoke AppleScript from perl / shell scripts. Thus you have the best of all worlds with Mac OS X.

    As a general guideline, when you aren't aware of what's going on you should post questions, not statements.

    --
    -- thinkyhead software and media
  6. AppleScript = Slow by Cbs228 · · Score: 1

    AppleScript is very slow when it comes to processing massive amounts of data. But it's the only language for playing TradeWars, a telnet game that was originally a dialup BBS door game, with a macintosh client, TWScripter 3. I've written a 93 page (118,388 characters) AppleScript bot for playing TradeWars (not publically available yet-- the help documentation would probably be longer than the code itself). But I still think AppleScript is too slow.

    --
    At our school, we don't earn a degree when we graduate—we earn pi/180 radians
    1. Re:AppleScript = Slow by geek · · Score: 4, Insightful

      AppleScript wasn't designed to handle massive amounts of data. That's like trying to put a square peg into a round hole.

      Use the right tool for the job.

  7. Re:Advantages of AppleScript over sh, awk, sed, et by pudge · · Score: 4, Interesting
    The author of MacPerl once wrote a Perl OSA component. It was an essentially failed experiment, though I couldn't tell you all the reasons why. What I can say is that I don't think it's necessary for most purposes. MacPerl can speak Apple events, and now perl under Mac OS X can too, with Mac::Carbon. Soon Mac::Glue will also be ported to Mac OS X, allowing you to directly access "AppleScript" vocabulary from Perl, with stuff like:
    #!/usr/bin/perl -w
    use Mac::Glue;

    my $iTunes = new Mac::Glue 'iTunes';
    my $tracks = $iTunes->obj( tracks => playlist => 'Blues' );

    $iTunes->activate;
    $iTunes->play( $tracks );
    That's hopefully coming to Mac OS X in January or Frburary, but don't hold me to it.
  8. Other Applescript news by fordgj · · Score: 3, Informative

    This is one among some other applescript goodies that have been announced. Interestingly, thye are releasing GUI interaction, something that was previously only available via third party tools like Prefab Player. Also, if you look in the new player, there is a setting for which language to use. Thus, there is the flexibility to use other languages (fronteir?).

  9. applescripting csh and csh'ing applescript by ubiquitin · · Score: 4, Informative

    Don't forget that you can put AppleScripts into shell scripts via the "open" command and vice versa you can call shell scripts from AppleScript by opening a terminal session for them, i.e., executing a .term file.

    There's no need to bicker about scripting languages when they can call each other.

    It's all good.

    What the world needs is fewer karma whores and more good friends.
    Go ahead, friend. :) Click that white button and turn it green.

    --
    http://tinyurl.com/4ny52
    1. Re:applescripting csh and csh'ing applescript by Cantus · · Score: 4, Informative
      Even better, you can execute AppleScript commands directly from a shell script with the "osascript" command. Check man osascript.

      And the reverse is also possible: executing shell scripts directly from AppleScripts using the "do shell script" command.

  10. Re:The editor? by Anonymous Coward · · Score: 0

    Different purposes.
    If you want to write in Perl, go ahead and write in Perl. Just install it with fink or whatever.

    If you want to write in Applescript, write in Applescript.

    IMO, most people would have a much harder time learning Perl than they would Applescript.

    As for being limited, remember that it's a *scripting* language, not a programming language.

    Note that the original script editor (for Mac OS Classic) supported multiple languages, including Javascript.

  11. Re:The editor? by kalidasa · · Score: 2

    Posts like Parent suggest a a new /. mod type may be in order: "Uninformed".

    OS X has PERL. If you want to write code to allow apps in OS X to interact with one another without passing large amounts of information, you use AppleScript. If you want to do a lot of textual heavy lifting, you use PERL. You want to write an application, you can use Objective C, Java, or use C with the Carbon libraries.

  12. GUI Scripting by X_Caffeine · · Score: 3, Interesting

    There's a good bit on Daring Fireball about GUI Scripting, a new feature of AppleScript that allows developers to control applications that do not have Applescript support. It's, um, weird.

    --
    // I will show you fear in a handful of jellybeans.
  13. Re:Advantages of AppleScript over sh, awk, sed, et by Jobe_br · · Score: 2

    Cocoa apps have quite a few 'hooks' enabled by virtue of being Cocoa apps, don't they? Thought I'd read in Apple docs that this was a feature of developing your app in Cocoa v. Carbon ...

    Cheers.

    p.s. Can Java apps receive Apple Events?

  14. Re:The editor? by Anonymous Coward · · Score: 0

    Got to love how the Linux/Perl/GNU hippies can really prove their points with maturity and intelligence.

    Damn, you are a truly sound defense for your obscure, slow solution (Perl).

  15. AppleScript STILL mysteriously unpromoted... by dpbsmith · · Score: 2

    About once a year I need to use a bit of Applescript for something, and once a year I again fall into a morass of tips-n-tricks articles, Web tutorials, popularized and out-of-date books, and a very complete Applescript manual from Apple whose existence is hard to discover and which is almost useless without good documentation on Finder scripting, which seemingly doesn't exist except for the Finder's Dictionary itself (which is about as complete as a typical .h file).

    When HyperCard was introduced, it included a very decent tutorial and reference manual in stack form, and a good print manual was available from Apple.

    AppleScript may not be the greatest thing since sliced bread but it is darned good.

    Peace, Perl users. Relax, TCL users. No argument, REALbasic or VB fans. I'm not criticizing your favorite languages. I'm just saying AppleScript is darn good--and is beautifully integrated into the Mac OS. Not everyone wants or needs a Mac-OS-oriented scripting language, but there IS one, and it's lovely.

    Why, oh why hasn't Apple produced a good set of AppleScript books--comparable to, say, those REALsoftware has for REALbasic? Why doesn't it try to SELL them as a checkoff option on their build-to-order menu?

    It's great that it wasn't lost (along with so much else good System 7.5 technology). It's great that they recoded it native. It's great that it's in OS X. But it is still a hidden treasure.

    Right now, about 0.001% of all Apple users know and use AppleScript. It should be more like 1%.