Bike Scripting Goals

Edit: These goals are still valid, but I did add more scripting support to Bike for the 1.0 release than I initially expected. Bike 1.0 has a pretty good AppleScript dictionary for “external” scripting. I still plan to add “internal” JavaScript based scripting at some later time, will probably refer to it as “plugins” instead of scripting to distinguish from current AppleScript support.

Bike Scripting Goals

Bike doesn’t have much scripting support yet, and it likely won’t until after the 1.0 release. At the same time scripting is a very important part of Bike’s future. I’m going to sketch out some scripting goals and ideas here so you’ll know how I hope it will work and so you can give me ideas on how you hope it will work :slight_smile:

  • Like TaskPaper scripting will be javascript based. Scripts are run in a javascript context that’s embedded in Bike.

  • TaskPaper scripts are limited to the current document. I hope to expand Bike’s scripting environment to include entire app, Windows, Documents, etc. Basically everything you can do via AppleScript I want you to be able to do within TaskPaper’s script context. I think my goal is to create something similar to Omni Automation.

  • Plugins will be the preferred way to run scripts. They will be loaded into Bike’s scripting context at startup. They will have ability to observer changes and add commands. Scripting will also be possible through AppleScript in a similar way that TaskPaper scripting is done… use AppleScript to submit code that is then run within Bike’s internal javascript context

  • Stretch goal, plugins will be able to present web view based UI’s in a sidebar “Inspector” view. This plugin view code will run in a different scripting context from default plugin code. A plugin that wants to display a view will have multiple script files… one that runs in main scripting context and can access TaskPaper model. And another that runs in WebView context. They may communicate by sending text messages back and forth.

A million details to fill in, but I think that covers the big picture.

Inspiration

Here’s a list of existing scriptable apps that use the same underlying JavaScript context based design. I’m sure I’ve missed some, please let me know about other apps to add.

Implementation

It seems like there’s a fair amount of common infrastructure code that could be shared between scriptable apps, especially if you are building a document based app.

I’m on the lookout for an existing Swift “scripting” package that I could use. Omni used to have a lot of open source frameworks, but I can’t find anything for Omni-Automation. Is anyone aware of a package/lib/framework to help with building a javascript context based scripting environment? If so please let me know.

Since I haven’t been able to find anything so far I’ve started my own “ScriptLib” package here:

There’s nothing Bike specific there yet, but it’s currently the foundation that I plan to build Bike scripting support on assuming I don’t find an existing library. Please take a look and try out the little that’s there. I’m unlikely to work much on it for the time being and would welcome anyone to start looking at the code and pushing it forward with pull requests.

Thanks,
Jesse

5 Likes