09 August 2006

Moving on to AppleScript

I've been super busy here at WWDC 2006, but it's that good kind of busy. Lots of new technology to learn and understand. It's been great! I did take some time yesterday to review some of the feedback online about our announcement to ship the next version of Mac Office without support for VB. This was a tough decision and one of those wicked problems that happen from time to time in software development. I think Erik's explanation of the challenges involved is one of his best posts yet. If you care at all that we are removing VB from Mac Office, read his post before you pass judgement. There's a lot of context to be had in there. Saying goodbye to Visual Basic Rich Schaut follows on with a post about what money can't buy and the challenges of software development in general. He then makes this comment:

But that does not mean we are unaware of the pain this will cause to a significant number of users. If you think we are not aware of that pain, consider this. David Weiss can give you a better number on this, but our testing methodology has always made extensive use of scripts for automated tests. Not just a couple of scripts, but thousands of scripts per Office application. At one point, all of those scripts were written in VB/VBA. In order to carry that testing effort forward into the era of Universal Binaries, every single one of those scripts had to be rewritten in AppleScript. I don't think it's even a remote exaggeration to say that our use of VB/VBA was at least a couple orders of magnitude greater than even our most automated customers. Do we know your pain? You bet we do.
This is absolutely true, we feel the pain. When we removed VB, immediately we lost more than half of our automated test bed. We've been carefully building back up our automation in ways that make sense, but it's a huge loss that those scripts no longer worked. That said, we know that AppleScript is capable and something we can depend upon long term not only for our testing efforts, but also for workflow customizations that our pro customers will use and build upon. Just last night I was at a WWDC party and I was introduced to a developer who had written a very cool script in VB to automate some of the work he and his team does on a regular basis. He was obviously concerned about what loosing VB would mean to him and his team with the next version of Mac Office. Everything he was doing with VB could be done in AppleScript and when we explained how AppleScript Studio provided a real IDE and UI workshop for developing custom solutions, he was very excited. If you have custom VB scripts, may I suggest looking into AppleScript as an alternative solution? There are great resources on building AppleScript automated workflows and it really is the Mac standard for inter-application communication. We are always looking for ways to make our AppleScript support better, so if in trying to make your VB solution work in AppleScript, you run up against a wall, let me know either in comments or via email. I think you'll be surprised at how much can be done with AppleScript today.


Anonymous said...

Well, as an Applescript user, who has never touched VBA for anything other than the most basic use, all I can say is:

Cool! Sorry for the people who are not going to be happy, but I tell you what. A large number of people like me will be able to put Office to use in ways we never did before. So, for us, thanks!

Anonymous said...

Making Word/PPT/XL/E'rage recordable and attachable, (E'rage is already attachable) would be quite handy

Anonymous said...

What's deeply uncool about this is the complete loss cross-platform scripting functionality. Cross-platform VBA works well enough now that I can send files to and receive files from Windows-using colleagues and our Office macros work. Office for Mac can no longer be a part of a serious Office based workflow and that's very disappointing.

William Gallagher said...


Could you think about adding some way to launch AppleScripts from within Word 2007, please?

I ask because I've been looking at converting my macros to AppleScript and it's going quite well except that of course I can no longer run the scripts from a keystroke or a toolbar button. So I find in day to day use that I just don't use them, even now I've switched off the keystrokes to run the old Word macros.

Unless I'm being thick and there already is a way to do this, I hope it'd be a simple enough addition for you and it'd definitely easy this move for me.


David Weiss said...

Excellent suggestion, William! We'll definitely look into that.

David Weiss

Anonymous said...

I'm not all that familiar with Applescripting MacOffice, but I am pretty proficient with VBA.

Is there a method (using Applescript) to manipulate Excel cell contents?

In other words, you could easily design a VBA script to examine the contents of a cell or cells and then enter data in specific into a cell. This could be something as simple as altering the format of a cell.

An overly simple example (typed on the fly) should illustrate an example:
Do While Cells(x,1).Value <> ""
With Cells(x,y).Interior
.ColorIndex = 35
.Pattern = xlSolid
End With
Cells(x,y).FormatContitions.Add Tpe:=xlCellValue, Operator:=xlEqual, _
Formula1:="=""> # Months"""
Selection.Numberformat = "m/d/yyyy"

Anyway, the above snippet should illustrate some basic ideas.

Can this level of scripting be done via Applescript?