FoldingText 2.0 AppleScript example

AppleScript support has changed significantly in FoldingText 2.0. All FoldingText scripting is now performed through a single evaluate command which takes a JavaScript string as a param. This is understandably a bit confusing to seasoned scripters, but I’ve got an example that I hope will show why I made this change.

FoldingText 1.0 had a AppleScript that implemented a version of Mark Forster’s Autofocus time management system. You can see that script here.

I’ve just updated that script for FoldingText 2.0 and posted it here.

The number of lines are similar, but the old version has so much indirection and is for me (who wrote it) just really hard to follow through and read. While the new version is a pretty strait forward manipulation of the FoldingText node tree. Plus I used the new SDK debugger to help write the new version, literally took 10 mins. While the old version took hours trying to track down all the bits of what I can and cannot do with AppleScript.

I notice this morning that Apple seems to be moving towards Javascript as an inter-application language (an alternative or successor to Applescript).

JavaScript for Automation