Bike 2 Extensions Preview

The Bike 2.0 (preview) JSContext scripting is very fast !

Thinking about its interaction with the rest of the system, and for example, reconstructing a slightly specialised Bike 1.0 osascript Copy As like this:

(which prepares an html rendering of selected rows, in Mail’s native format, and places them in a public.html pasteboard item with a JXA function like the one below)

Expand disclosure triangle to view JS source
// setClipOfTextType :: String -> String -> IO String
const setClipOfTextType = utiOrBundleID =>
    txt => {
        const pb = $.NSPasteboard.generalPasteboard;

        return (
            pb.clearContents,
            pb.setStringForType(
                $(txt),
                utiOrBundleID
            ),
            txt
        );
    };

I wonder whether, at some point, it might look feasible to enrich the Bike 2.0 Clipboard interface, adding uti or bundleID parameters to writeText and readText, or perhaps to generalised siblings of them ?

(as in the .setStringForType and .dataForType of NSPasteboard's generalPasteboard)


( In the meanwhile of course, an external process can already read and parse the com.hogbaysoftware.bike.xml of Bike 2.0’s clipboard )

1 Like