Scripting access to document content

Generally scripting will be something that’s done in JavaScript and that will be addressed post version 1.0.

For Bike 1.0 I would like to add basic read/write access to document content. In simplest form I could do this by adding a string property (maybe “bike format”) to document that returns .bike formatted HTML. To edit a bike document with a script you could read/mutate/writeback that string.

Does that sound reasonable, or is there a better way to do it?

1 Like

That sounds good – saves us from having to read the file from its path by script.

At some point – perhaps something for the subsequent JS API, it would be good to have access to a shorter .bike HTML string representing only the content visible in the front window.

(e.g. the currently focused sub-tree of the outline)

Not sure whether a string property like .visibleOutlineInBikeFormat seems too specialised or ambitious for a basic document object.

(In any case we can already get it through the pasteboard after scripting a ⌘A select all, followed by a ⌘C copy).

Or perhaps, if the costs and complexities of argument passing over that interface look manageable at this stage – something like:

.bikeFormat(visibleOutlineOnly :: Bool)