How to get path to the note open in Obsidian (using javascript or JXA)

Things I have tried

  • Have searched google, GitHub and this forum for a script that returns file path of the note open in Obsidian.
  • I am sure it is super easy, but have spent some time trying to find it and therefore posting here.

What I’m trying to do

  • I would like to obtain a file path for the note that is currently open in Obsidian.
  • With the file path, I can process the markdown note using scripts.

Will appreciate if you can point me to a script that enables this and can be used with JXA (Javascript for automation) on Mac.

Thank you!

Take a look at the Shell commands community plugin. From the description, it lets you pass the current file name and path to a script. I’m assuming that you can call your scripting engine from the command line. If that’s not the case, you probably need another solution.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.