Archives par mot-clé : AppleScript

Kneel before AppleScript !

To say that I am surprised by the sheer success of Lion DiskMaker is an understatement. Actually, I thought that Lion DiskMaker could be just a fun project to deal with and would not have much impact, but the incredible response from every part of the planet is quite thrilling. I am really pleased to see such nice comments from every corner of the planet, and it’s really fun to read about Lion DiskMaker in Twitter.

The stats from this blog are quite interesting as well. Usually, I get about 200 visits per day, sometimes around 1200 visits when I publish a blog post. The fact that I write in French, and note quite often, has, of course, some impact on these numbers.

However, Since last Saturday, there’s been more than 85 000 visits, only on the US page. The French version got  about 20000 visits. It means both these pages have been seen more than 100 000 times. Quite a big number for me !

And of course, there were donations, some quite big ! Thanks to everyone who sent a donation, this is really, really appreciated !

So, I read quite a lots of articles about Lion DiskMaker these days. I found wonderful to see long reviews of the software in so many different languages. Some people even called me « a programmer » ! Wow ! That is the first time it happened ! But hardly myself consider a programmer. Heck, I did not even make a single application using XCode. My day-to-day job is being an Apple Consultant, writing books in his spare time, not programming stuff.

However, in Mac OS X, there is this powerful tool, which has been there even before Mac OS X, which so many people heard of but never really tried to understand.

Of course, I’m talking about AppleScript.

Indeed, AppleScript is far from being a new technology : it arrived in the 90s, with System 7 Pro 1. It was almost canceled as a time, then resurrected and got an incredible boost in Mac OS 8.5. If you want to read a thorough history of AppleScript, check this PDF.

However, since its arrival on Mac OS X, AppleScript earned some bad reputation : its syntax is complicated, it can be difficult to do what you want with it, there are other languages which you can use, like Python, Ruby, tcl… These are comments coming mostly from experienced programmers, not common users.

But the thing is, I am not a programmer. Really. I never learnt C or Pascal at school, I never tried to get C# or Objective-C, or Java, or Ruby or tcl or whatever classic language you may think of. Maybe I tried to learn a bit of BASIC, but it was a long, long time ago. Even HTML is sometimes difficult to get for me (though less complicated than the usual suspects). I don’t dislike these languages. I tried to study them, to understand them. But I always thought they were too complicated for me.

The problem with AppleScript is that it is not designed for full-time programmers. So, programmers sometimes just dislike its simplicity. Respected bloggers like Daniel Jalkut or John Gruber think that Apple should just ditch AppleScript and go full Javascrpt. I hope Apple will not listen : it would mean the end of scripting for (almost) everyone. Sure, AppleScript has its flaws (mostly because of the tools provided to use it, as mentioned John C. Welch in a brilliant post), but it is also amazingly simple. I can’t read Javascript easily. I can open an AppleScript and understand it almost instantaneously, because it uses English words in a sentence-like form2.

When applications implement it properly, you can do amazing things while writing (almost) just plain English. Lion DiskMaker is an ode to my love for AppleScript : though I don’t use it as often as I would like too, I managed to create this application in a few hours, just using the basic AppleScript Editor. Of course, there is some magic inside, and it is provided by the incredibly powerful do shell script command, which can quite easily supply AppleScript the missing commands it would need. Because AppleScript has its limits, which sometimes are a bit too low. But it is not a problem with AppleScript, rather a problem of implementation. And Apple seems ready to improve AppleScript by introducing AppleScriptObjC, which, honestly, I did not try to get into… Not enough time, sadly :(

« Real » developers may laugh because Lion DiskMaker is written with AppleScript. But at the end of the day, we should just see the result. The language behind is just a tool. If AppleScript allowed to create something like Lion DiskMaker, then it means it’s as good as a language as « grown-up » scripting languages while still being easy to understand by non-developpers.

And this, really, is an incredible achievement for AppleScript. If I managed to create Lion DiskMaker almost all by myself, it means that Apple succeeded with AppleScript by making scripting accessible to almost anyone.

  1. Yes, Apple had a « Pro » system a long, long time ago…
  2. At the time I began to work with AppleScript in 1995, I could even write scripts in French ! Multiple dialects were supported, but Apple abandoned them a long time ago. They are not missed, however.

Lion DiskMaker 1.2 est disponible

La version 1.2 de Lion DiskMaker est disponible en téléchargement ici (384 Ko environ). Si vous avez rencontré des problèmes avec la version précédente, je vous invite à télécharger la nouvelle version. N’oubliez pas de consulter la FAQ au préalable.

La liste des nouveautés :

  • Je vous rappelle au passage que si vous n’avez pas l’application Installation Mac OS X Lion copiée dans le dossier /Applications, Lion DiskMaker ne pourra pas fonctionner. Et ben si AH AH AH ÇA MARCHE MAINTENANT !!! Si Installation Mac OS X Lion n’est pas dans /Applications, une copie sera recherchée par Spotlight. Il est cependant possible de choisir une copie située à un autre endroit.
  • L’application respecte le choix du navigateur par défaut lorsqu’une page web est ouverte plutôt que d’imposer Safari.
  • Plus de feedback lors de la création d’un disque de démarrage. Le dossier du disque est affiché et un texte apparaît « Copie en cours… » durant la copie. C’est moins beau qu’une jauge de progression, mais ça annonce un peu plu la couleur.
  • Changement du terme « Clé USB » pour « disque », plus générique, et réfléchissant mieux le fait qu’on peut utiliser différents types de disques et pas que des clés USB…
  • Un peu plus de commentaires pour les courageux qui veulent regarder le code…

Dans le prochain épisode :

  • Localisation US
  • Structure adaptée à une version multilingue.

Et un peu plus tard…

  • Choix du volume si on souhaite garder les autres partitions intactes (pour les gros disques).

Lion DiskMaker 1.2 est DonationWare, donc si vous voulez faire un don, ne vous gênez pas :)