[Pending] Events to invoke actions

I’d like to see user interactions (like clicking a checkbox) create an event which would be available to invoke an action script. If there’s no attached script, there’s a default event handler that does nothing. It could be useful to allow multiple scripts per event (but I’m not going to insist on that - one would be enough for me).

For me the use case would be “click on a checkbox => force the note to use GitHub Markdown and put the strikethrough delimiters round the text with that checkbox”.

I’m sure I could think of others, but that’s todays request.

I wrote a script last month that creates Prompt Checklists from a Draft.

Might not be excactly what you asked for …

Would that be helpful?

It could be. If you’re willing to share I’ll gladly look at it. Even if it’s not quite what I’m looking for I’ll learn from it.

Thanks.

Action is here https://actions.getdrafts.com/a/1bx

It takes a Draft in this style:

# Heading 1 
- [ ] Question 1.1
- [ ] Question 1.2

# Heading 2
- [ ] Question 2.1
- [ ] Question 2.2

And displays any Question with a Yes No button and a text field for optional comments

Output will be in clipboard as JSON

{"#1":{"question":"- [ ] Question 2.1","answer":"Yes","comment":"a","topic":"Heading"},"#2":{"question":"- [ ] Question 2.2","answer":"No","comment":"b","topic":"Heading"}}

Feel free to ask and share your results.

Enjoy.

Andreas

1 Like

The full checklist it was developed for:

Checklist: Notation, notation, notation

A software architecture diagram review checklist

TODO: make executable?! with prompt

Structurizr - Help - Diagram review | Printable PDF version

General

  • Does the diagram have a title?
  • Do you understand what the diagram type is?
  • Do you understand what the diagram scope is?
  • Does the diagram have a key/legend?

Elements

  • Does every element have a name?
  • Do you understand the type of every element? (i.e. the level of abstraction; e.g. software system, container, etc)
  • Do you understand what every element does?
  • Where applicable, do you understand the technology choices associated with every element?
  • Do you understand the meaning of all acronyms and abbreviations used?
  • Do you understand the meaning of all colours used?
  • Do you understand the meaning of all shapes used?
  • Do you understand the meaning of all icons used?
  • Do you understand the meaning of all border styles used? (e.g. solid, dashed, etc)
  • Do you understand the meaning of all element sizes used? (e.g. small vs large boxes)

Relationships

  • Does every line have a label describing the intent of that relationship?
  • Where applicable, do you understand the technology choices associated with every relationship? (e.g. protocols for inter-process communication)
  • Do you understand the meaning of all acronyms and abbreviations used?
  • Do you understand the meaning of all colours used?
  • Do you understand the meaning of all arrow heads used?
  • Do you understand the meaning of all line styles used? (e.g. solid, dashed, etc)

With a little extension - fill in fields - I could use this to set up a client engagement set of files and folders on the Mac.

A flat file based thing like this would be preferable to my current solution: A stonking great :slight_smile: Keyboard Maestro macro.

1 Like

Did anyone find the time to test it?

I’ve had less time that I hoped this week, but tomorrow is Saturday, and that’s when I’ll have a better look.

1 Like

“Looks like I picked the wrong week to” test your action. :slight_smile: :frowning:

(Cultural reference.)

1 Like

Downloaded, installed and played with it. I like what it does but I’ve yet to think if a personal use case for it.

2 Likes

Poor form to reply to myself, but I’ve extracted useful information from the script, so thanks.

Right now, what I’m writing is incomplete and ugly, but when it does what I need I’ll prettify it and upload it. I’m still very new to scripting for Drafts, but it looks as though I need to create a new note with the changes that I’m looking for, and change the tags for the current one so that it’s retained but as a previous version. Does that sound right?

1 Like

If you want to perform the action you described in the first post, this would not need a new draft.

It could be done on the same draft.

One approach would be

  • get the content of the draft
  • split it
  • prepare an empty output string
  • take the user interaction
  • fill the output string based on the users action (checked or not)
  • put the output string as content in the draft
  • update the draft (draft.update()

Ahh! Thanks, that’s a whole lot easier. Good to know.

I’m collecting the content as I go in the script right now, so all I need to do is the update.

1 Like