Alarm for specific word count

Hi, not sure if this is possible, but is there a way someone could write an action for me to have a bell sound when I’ve reached a certain word count. I’m blind, so glancing at the word count while writing isn’t really an option. Just a thought I had.

It is not possible to trigger an action simply based on changes in the editor, unfortunately. There’s no direct monitoring going on. It’s an interesting idea.

Hi @agiletortoise ! Another VoiceOver user here. You mentioned somewhere that you will expand support for AppleScript in Drafts at some point. Will it be possible for you to add built in word count as part of AppleScript dictionary? This way we could assign keyboard shortcut to announce word count with VoiceOver output or with “say” command without to move VO focus to word count area. I implemented it in TextEdit and it works really well. Basically found a script on the web for showing you dialog with word count, replaced dialog box part with VoiceOver output.

Back to what @Dave_Bahr asked about. Wouldn’t it be possible to do that via AppleScript and Keyboard Maestro to have macro with periodic trigger? Not ideal/user-friendly, but at least is an option?

Live parsing - which you’ve just built with Custom Syntaxes - might be a jumping off point for this.

I can think of instances - such as “I just made a new heading”. That one might trigger a “now do something with everything from the previous heading onwards” kind of action. And, to give a trivial example, that one might be to check off a “I drafted this section” task.

Syntax highlighting is (1) not linear enough to act as a source of triggers, and (2) super important to remain performant. No one wants lags while typing.

Consider that something like “I just made a new heading”, isn’t really a thing in an of itself. When you select a draft and load it in the editor, it might have five headings that Syntax highlighting just found. If you paste a block of text in, it might, too.

Triggers are something I am interested in adding down the road, but they would be more based on events like “draft loaded in editor”, “text changed in editor”.

This thread did draw my attention to the fact that action completion messages are not getting announced properly to VoiceOver. Fixing that this morning. Once a release with that fix is out, it would be easy to create an action that would announce the current word count.

1 Like

So maybe what we’re talking about here is a “typed string trigger” - to borrow a term from Keyboard Maestro.

Of course, if you have Keyboard Maestro you can already do this (on Mac). Though:

  1. It’s only Mac.
  2. It doesn’t have deep access to all Drafts has to offer.

Hey @agiletortoise, I went through the scripting documentation and didn’t find a way to customise action completion messages. What am I missing?

Ideally, what I’m looking for is:

  • A script runs
  • A message gets spoken by VoiceOver
  • No completion sound is played

I was looking for something like an accessibility object that would have methods like say, which I think would be great. That way we are not mixing the concept of a completion message with some text needing to be spoken. This also allows for workflows where a text needs to be spoken in the middle of a script, not necessarily at the end. Without it, it would sound to me like scripts would basically need to be split, just to make speech feedback work correctly.

The app object has displaySuccessMessage, displayErrorMessage, etc. methods. These will announcement the message provided.

If you are wanting to totally customize the messages, be sure to also set “Notification” options on the action itself to “None”.

1 Like