Cross-Platform Scripting via notes

Hey guys, loving Joplin so far. I have a little proof of concept of a feature that I wanted check with everyone and see if it'd make sense to include in the main application. For now, I just have this running on my own fork (jcgurango/joplin) There's an old topic here about it but it's been closed as being able to be solved with a plugin:

So I've implemented an executor for running arbitrary scripts, and this works on both mobile and desktop. Here's how it works on Desktop and Mobile: Basically you just need a note with a single code block starting with ```js executable and the apps will know that it's an executable note. The scripts can interact with Joplin notes and folders.

The applicability of this doesn't really intersect with the applicability of plugins, this is more for one-off scripts. For example, I use it right now to organize my to-do list and move notes from one folder to another, archive them into folders of previous dates, that kind of thing. That particular use case is really simple and specific to the way I wanna set things up (i.e. if it was implemented as a plugin it'd need a lot of options and stuff), this way I can just code it the way I want to.

Naturally, you need to have programming knowledge and know a bit about how Joplin works internally, so maybe there's ways the API on the scripting side can be simplified or something or maybe that's just a documentation thing. I haven't had a use case for it yet, but I was also thinking maybe notes could execute other notes for more complex behavior.

1 Like


Not sure whether it is relevant for your use cases, but having browsed in detail Joplin's plugin repository recently I think you may find this plugin interesting: GitHub - S73ph4n/joplin_automate_notes: Joplin plugin to automate notes with javascript (look for Automate Notes if you install it via the Plugins menu within Joplin).

By the way, just being curious - what do you do to your Todo lists with custom JS scripts?

That's pretty neat! What I'm working on is similar but that one is more limited in scope since it doesn't seem to be able to interact with the Joplin objects.

With regards to my Todo list, currently I have a few folders with different designations, "Today", "Tomorrow", "This Weekend", "Next Week". I fill those up with tasks throughout the week, and I have a script note in my "Today" list which will

  1. Move the today notes/todos to a new folder with the date in another folder called "Archived"
  2. Move the "Tomorrow" notes to the "Today" folder
  3. If it's Saturday, moves the "This Weekend" notes to the "Today" folder
  4. If it's Monday, moves the "Next Week" notes to the "Today" folder

It also searches through another folder for notes that start with "CurrentDate:" (e.x. "2023-03-24: ") and moves those in, and I have some other special ones too for like recurring tasks (e.x. everyday, every 1st, etc.) which will copy the note instead of moving it. (For some tangentially related background on why I do things this way, I actually developed an app that I never released but used for a solid year that worked this way called LunaDo)

A plugin for scripting is nice, but I really need the scripts to work on mobile too which is why I developed this feature into my fork.

Can't really help you more regarding Automate JS & in-note JS implementation in general as so far I didn't feel the need for such features.

Thank you for sharing your Todo list method, as I am trying to redefine mine. Though for now I like more the way the plugin Inline-Todo works (also currently trying it with the pane added with this other Bundle plugin). But I stop here as this is not a topic on todo list :slight_smile: .

Hi there! That sounds like a really interesting feature you've implemented in your fork of Joplin. Being able to run custom scripts on notes could be a powerful tool for users who are familiar with programming.
In terms of whether this feature would make sense to include in the main application, there are a few things to consider. First, it's important to think about the potential security risks associated with running arbitrary scripts on a user's computer. How would Joplin ensure that scripts are safe and can't be used to do something malicious?
Second, while this feature may not overlap with the functionality of plugins, it's possible that some users could accomplish the same things with plugins. How would this feature be differentiated from plugin functionality?