JavaScript is regarded as extension technology, while Shortcuts and AppleScript as automation technology.
The good news is that MarginNote will support AppleScript from version 3.6.5, which is already in the development process and well on track(3.6.4 will be skipped in all probability). Currently, we plan to recruit several community members who understand the AppleScript to participate in beta testing(maybe in the next week or two).
In addition, it is fairly certain MarginNote will support JS as a built-in extension method. We learned from the Apple Developer Documentation that Apple has made pretty mature JS bindings. That’s why JSBox exists. Given its performance, stability and extensibility, JS is almost the scripting engine designated by Apple. Thus, you can basically call internal methods directly through JS.
Meanwhile, JS can be easily combined with Shortcuts on iOS and AppleScript on macOS. Through the technical architecture envisaged, the functions performed by AppleScript can be easily open to JS.
This progressive process will span several versions from 3.6 to 3.7. It is possible to use this extension technology when designing a new synchronization framework.
The open interface is expected to consider following scenarios:
Customized Search–Count the frequency of a word. Existing search method will list all results, but there are no statistics. Ideally, the number of results will be returned when searching.
Exporting Notebook Data–Automatically and regularly back up and store to a third-party cloud.
Adding Cards Automatically --Unlike Anki, MN is a free field, so you have to manually select the question part. In fact, this is expected to be automated through a script. The users define some rules and then MarginNote automatically generates the desired card, e.g. filling in the blanks.
Adding, Filtering and Exporting Notes(text processing)-- Entry for notes will be available. You can capture the latest real-time sentence examples from Vocabulary.com and append to the notes. In addition, we can provide an API for filtering notes and performing operations, such as filtering certain notes, automatically generating notes, and so on.
……
You devoted users are welcomed to supplement the scenarios above. We will be grateful for your participation.
This is exciting. Being able to extend and by directionally synchronize my notes back into my Core system will be huge.
Additional thoughts,
Be able to push audio recordings to a speech to text API
exporting notes is something I am very excited about, particularly being able to do so with surrounding context like the related highlight and tagging. Being able to better connect my notes and in-flow thoughts to those generated in other areas or over time.
Thanks for informing us about this. From your message, it sounds like your intention is to support AppleScript from MarginNote 3.6.5. However, I just upgraded to 3.6.5 this week, but I don’t see scripting support from Apple’s Script Editor app. Is there a revised roll-out date?
May I ask, what are your plans for documenting the AppleScript, JS support, and also the API for filtering notes?
Also, is there any possibility that you might document the SQLite database schema?
I ask about the latter, because I ended up writing my own app to do complex searches of the MarginNote database for my notes, and to export the results in RTF (see below). This is along the lines of some of scenario #4, that you describe above. The app does much of what I want, but some things I haven’t been able to figure out without documentation of the database schema.
Thanks, and looking forward to the new scripting functionality.
I just received your inquiry, and the development progress is relatively smooth, but it has not yet been released. We may provide an internal beta version of the bound device ID independent of the official version for testing in the near future. I have consulted about the specific revision time. I will inform you as soon as I get confirmation tomorrow.
The Assistant program you made is very amazing. I will let Kevin inform you of the information you need as soon as we get the SQlite mode document.
@mobo Is there any possibility you can share your app (as-is, no guarantees, no support)? MN3 RTF export is horrible and weirdly formatted, so any alternative would be most welcome.
It has been confirmed that the related-tech. has all worked, and currently all data can be accessed through the API. The simple interfaces and control logic could be supported, but several key API have not yet been determined, so still cannot be opened.
In addition, we have discussed about your request, considering that the Data Interface is fully prepared, it will only allow users to access the database in the way of AS / JS API. Database consistency and compatibility are guaranteed by the code, and there is no reason to open a separate database access. Of course, guessing the database based on your own experience is fine. I believe that in the near future, you can call more complete data through API.
If you have any questions, please ask me. Filtering and exporting is a topic we focus on, and even the entire API is set up for the purpose of export enhancement, aiming that your notes belong to you.
Yes, I understand the integrity issues, so access to the database is read only. The reason to access it directly is so that I can use a better language than AS or JS (it would not be possible to implement the MarginNote Assistant in either of them).
@quorm Thanks for your interest. Since MN apparently doesn’t plan to support direct access to the database, I have no plans to release my code, sorry.
EDIT: FWIW, the solution I came up with for RTF export was as follows. I mention it as an idea, that could perhaps save another developer some time/effort.
To export a series of notes, the question was: how to format them nicely? This also applies to how the search results are formatted for display on the screen. What I did was create an RTF template file, like this:
Here, each line is an element, and each element has a distinct style. For display of search results and export in RTF, the app simply reads the template file, parses the RTF, and uses the style of each element. During export, the same styles are used. In this way, it’s completely WYSIWYG, and you can change the appearance of the exported notes easily by changing emphasis of the template. No special UI is required to select elements/fonts/color/size/emphasis, etc.
In the past, I have also tried using the macOS utility textutil to convert from RTF and other formats. It works, but the formatting is inexact. Writing RTF direct is a better solution, I’ve found.
My primary use case for automation would be to set up synchronization between Marginnote mind maps and iThoughts, which is my preferred mind-mapping software. Are meta operations like export and import on the roadmap?