BushelScript: A next-generation open-source alternative to AppleScript

Hi all, I don’t know of any better place to post this, but if this topic is not a good fit for this category/website I will gladly move elsewhere.

AppleScript has always amazed me with the promise of deep, complete control over macOS. It allows a user to manipulate their data when they want it, how they want it, without ever messing with special data formats or app-specific API hooks. They can just use AppleScript.

AppleScript is a special language because it can communicate directly with apps through AppleEvents. This is the very reason it was created, and is the sole reason it is still alive today.

And yet, if you’ve tried to use it seriously for more than a couple of hours, I think you’ll agree that AppleScript is a pretty terrible language. It’s bizzare in some places (HFS paths), obtuse in others (the unnecessarily hard-to-use text item delimiters) and sometimes flat-out antagonistic, especially to newbies (want to use a dictionary-defined term as a variable name? Have a totally unhelpful error message instead). What’s more, Apple has stopped actively working to improve AppleScript, with the last major changes made in macOS 10.11 over four years ago.

And yet, AppleScript scripting interfaces are still very much alive and useful in a whole host of Mac apps from both Apple and third parties. The main issue at hand is that the language through which such functionality is presented is stuck in maintenance mode, unlikely to receive any badly-needed improvements in the near future, if at all. That is, unless we, the users, replace it with something better whose fate we can control.

(Full disclosure: what follows is a description of my personal pet project. However, I am not gaining monetarily from it at this time, and it is an open-source endeavour.)

BushelScript is best described as a next-generation open-source alternative to AppleScript.

As opposed to its big brother, BushelScript is open-source and community-driven, meaning it can undergo necessary changes and gain useful features rather than remain stagnant as a side project on life support.

The language can currently do much of what AppleScript does, and with a very familiar syntax. I’m interested to hear feedback and would love to build this up to AppleScript parity and beyond, not just on my own, but with you involved.

If you want to read the quick tutorial or maybe even test drive the language on your machine (it works pretty well already), please don’t hesitate visit the project’s website: https://bushelscript.github.io

I am not gaining monetarily from this; it is entirely free and open-source software. I might start charging for prebuilt copies of the BushelScript Editor application once the language matures out of beta, but that would be in the semi-far future and the project would still remain entirely open-source and community-oriented. I might not even do that. Whatever happens, this is as much your project as it is mine.

Thank you for reading, and I can’t wait to see what we build together.

— Ian Gregory

Bushel? it sounds too…white Hahaha

Ok, first of all, welcome on MacScripter!
looks like an interesting alternative indeed, as Applescript had not much competition so far.
In comparison to other languages, AS kept the same for a very long time - in good and in bad - until…who knows. I’d say nice somebody is thinking more in dept about the future of user friendly Scripting on Mac.

The most important aspects for me are,

• autocompletition
• auto indentation
• syntax coloring
• ability to jump back and forth btw handlers
• row of clickable handlers collected as cloud (tb displayed in the info column)
• integration of ObjC
• dark background / or like in terminal, ability to change bg
• improved processing speed (max possible for a modern scripting language)

keep rolling! :wink:

It is not a OSA-component(Script Editor does not recognize). It seems a kind of pre-processor. Isn’t it?

If you say this is the alternative, it have to have the co-operative functions with AppleScript, I think.
Some brave men said such a opinion with hysterical words. It was a kind of ugly speech.

Why did they fail?

(1) Too hysteric (like a Terrier…it comes from England)
(2) Few automation / localization experience (Oh…many tools did not work well on CJK user environment…haha)
(3) Programming language nerd (I think the automation language as a tool)
(4) Looking upon AppleScript as an enemy, too much. Apple’s dull & brain-deaded engineers may be enemy for me. But AppleScript itself is not a enemy. It is an important point.

BushellScript Editor seems nice. It works with light steps.
But I felt it as a torture in color-less room.

I recognize each rexical element by color. Syntax coloring is the most important feature in Script Editor.

Hi, thanks so much for your feedback!

Yes, there are definitely plans for this.

Hm, I hadn’t thought about that one. But good to note. You can always click “Pretty Print” to do the job for now.

I also had this in mind but decided to postpone it until I had things like autocompletion working. But again, good to note.

Okay, that shouldn’t be too hard.

That’s an interesting idea. Like a preview of the entire script file?

This is probably a long-term goal at best and a moot one at worst. I’d much rather there be suitable functionality provided in the standard library and by other dynamic languages (accessible through #!s in script files). If something like that is really needed, the ability to call handlers in AppleScript files is planned and would thus allow you to work with Objective-C things.

100% agreed.

From preliminary speed tests, BushelScript does in fact do some things faster than AppleScript. FWIW, BushelScript is built on LLVM, which means that in theory, things can get really fast. But it’s all in the finer details.

You’re right, it is not an OSA component. My vision for this language started out as an OSA component, then with an OSA component as a side option. But I believe that with Library Validation in macOS 10.14, Apple apps (including Script Editor) won’t load components that aren’t created by Apple. So I figure there’s basically no point now.

In reality, BushelScript is an entirely separate language from AppleScript. The reason it seems so similar to AppleScript is twofold:

  1. The language syntax intentionally looks similar to AppleScript so that AppleScript terminology can be imported from applications and not seem out of place.
  2. It can talk to apps just like AppleScript can.

So, yes, it does kind of seem like a pre-processor that converts to AppleScript. But in truth, most of the code is redone from scratch, which means it’s in our control, not Apple’s.

Yes, I also think this would be extremely useful. It’s definitely planned and feasible.

Do you mean BushelScript Editor? If so, yes, the app isn’t localized at all right now, it’s only a prototype and therefore only in English. Sorry about that. I’d love help with localization though, once the editor has a little more polish.

Good to know!

Hi Ian,

BushelScript Editor’s icon seems uncomfortable for Scripters.
I’ll advice you to change it soon, immediately.

Third party OSA component “AppleScript Debugger” is recognized

No, no. I think BushelScript Editor is not so bad.

I check the localization point at…

(1) Can launch on CJK environment
(2) Can hold or process CJK string data or emoji
(3) Can write CJK or emoji string with each text imput method.
(4) Menu and messages are localized
(5) Help and web sites are localized

BushelScript Editor marks (1), (3). Menu and helps are not so important.

I’ve been poking AppleScript with a stick for quite some time. Just to show my age, I can say I even dabbled in Frontier scripting. The “AppleScript Sucks” topic isn’t new and there have been other attempts to supplant AppleScript with something “better”. Often, these complaints are really “I don’t like how this works”. Which is not the same as “this doesn’t work”. I think you can compare AppleScript to Churchill’s description of democracy:

I’m not sure 4 years of no development of AppleScript is actually maintenance mode for Apple. I think they have gone longer between updates in the past. I do get the feeling that someone at Apple basically said “Here’s AppleScript Objective-C. Now, stop bugging us”.

Apple did briefly stick a fork in AppleScript after OS 9 but third parties convinced them it was a technology that was selling machines to the printing and publishing industry. My real point is this. If Apple decides to abandon AppleScript, I think, you will be trying to put a slaughtered lamb on life support.