[Project] Commandline Tool - Create new draft (Apple Script/Python)

Is there a way to create a new draft from the command line? Like either add a text file as a new draft or save the command output as a new draft?

I can think of a few ways, but the simplest would probably be to output to a text file in the import folder.

1 Like

Ah yes, that’ll work, thanks!

An interesting idea would be a command line utility that took tags and the draft contents. Probably doable in AppleScript.

My other thoughts were indeed some some AppleScript (run via osascript), and also triggering addition via a URL call. The write to the import folder just seemed the simplest option for getting the data in.

1 Like

I know. And, having perused the options for this the other day, I know you can assign tags on import.

Something like

newDraft tag1 tag2 -d “This is the title\n\nThis is the body\n* Item 1\n* Item2”

would be really nice. I can imagine code of mine issuing that command.

use python and the url :wink:

  • typer handles the agreements
  • url calls should be easy
1 Like

I found

  • xcall.app on github

and a thread date in march 2020

there is a wrapper in python (seems to be python 2.7 though)

robwalton/python-xcall: Implementation of x-callback-url (Inter app communication) on macOS using Python

or a rust implementation

I will look into it sometime in the future.

1 Like