Action to delete w no confirmation, then open draft list

To improve my workflow is it possible to create an action which would

  • delete the current draft without asking for confirmation
  • open the draft list of the current workspace
    thanks very much

Simple script action should suffice:

//set the current draft as trashed (deleted)
draft.isTrashed = true;
//Show the list of drafts

Note that the draft that is deleted is still loaded in the editor. If you want to auto load a different draft or create a new one and then open the drafts list, just add the extra line to modify it accordingly.

Do also have a good read through the Drafts Scripting Reference. There is lots of information about what you can do with Drafts in there.

1 Like

Thank you very much for the script
I have been looking for a way to learn basic scripting and avoid having to ask for the most basic script but am unable to find a good reference. I greatly appreciate your suggestion but end up either running around like a headless chicken from one link to the next leading to a half page of notes or find myself drowning in encyclopedias of scripting

Try my recommendation from this Automators thread if you are not having any luck finding something suitable yourself. Learn some of the basics of JavaScript, re-read some examples from the forum and the Action Directory, read the Drafts specific documentation and go from there.

As with any programming it is useful to give yourself some small projects as you go. The sort of thing you posted at the top of this thread is exactly that sort of starting point. Then use what you have learned to get you as far as you can, and what you are missing, you research. If you come up short or have a question, post what you have in a new topic and ask for some advice. There are lots of people in the forum who are very happy to help people get more out of Drafts and understand the capabilities available. :slight_smile:

1 Like

My profuse apologies.

There is a misunderstanding and it is totally my fault. I was running around in circles from link to link, when in fact the link you provided contains all the info I was looking for. I was looking at the center of the page and the information is in the left sidebar.

Confucius said : when the wise man points to the moon (in this case you correctly pointing to drafts actions and scripts), the imbecile (me) looks at the finger.

Based on your second link, I installed the following book on my Kindle and am very much enjoying it.
Eloquent Javascript 3rd Edition

thanks again very much and sorry for my bungling.

1 Like