Looking to create an AppleScript to batch add to notes section of a task

I like to use the notes section to put information into my tasks to refer to later. Sometimes I need the same information in a bunch of different tasks throughout OF. I want to select multiple tasks and/or projects and be able to get an input box to either type or paste in the information into all the tasks at the same time.

Can someone help me with writing this script? I’m new to AppleScript, but not to programming.

Great idea! I’m actually interested in doing this to add “tags” to the notes section. I will see if I can come up with anything. I will let you know if I do. If there are any existing scripts anyone else knows of please do chime in.

I realized that in Yosemite, I can write the script in JavaScript. So, I did just that. You can find the gist for it here: https://gist.github.com/gbcosgrove/f307117f71d210d88bc2

Just copy and paste this in the Apple Script editor, hit the compile (hammer icon) and save it. Make sure to append .scpt to the end and then move it into the omnifocus folder or wherever you keep your scripts. I’m going to make a clear notes and append notes script soon. Right now, if you select a task that already has notes, it will overwrite them.

Awesome, thanks! I am definitely interested in finding a way to append to a note, rather than overwrite it. I often add notes to tasks when I create them and I really would not want to overwrite those when I a process them.

I wrote a quick applescript that will prompt the user for text and add it to the notes of selected tasks (or append as a new line if the note already has content): https://gist.github.com/chrisbirdsall/3a963c08680c558898ef

Cool, I will check it out. I updated my code so that it appends the notes instead of clearing them. https://gist.github.com/d84ec4e53feacc56e1a5.git


Fantastic. Thanks so much!!! Spread the word about your script – It’s a huge help to those of us who would like tags in OF, since it allows us to add the same text to multiple items (e.g., #Tag1), which is like tagging multiple items. (I would still like to see a proper tags in OF though.) Thanks again!

I don’t know if you are talking to me or to Chris, but here’s the updating JXA version that doesn’t wipe out previous input into the note section. The old gist isn’t appearing, so I quick made a new one.

Well, the thanks go to you both of course, though I couldn’t get yours (gbcosgrove) to work – but frankly this is probably due to my own lack of experience/knowledge with this stuff. When I paste your script into the script editor and hit the hammer, I get an error message that says “A class name can’t go after this identifier” (and it highlights the words “var app” at the top). Thoughts? I don’t know what the error message means or how to fix it.

Also, I would actually be really interested in having the script for your older version as well. Sometime i will want to edit the notes in multiple tags by wiping out what was previously there and replacing it, and sometimes I will want to add to the notes without replacing what’s already there. Both scripts would be useful; they serve different purposes.

For example, what happens if I make a mistake one day and inadvertently add some text to a bunch of notes using the script? In that case, I would want a script that would allow me to replace the entire note field in multiple item-- not just a script to add to the note field. So I could really use both.

@gbcosgrove @chrisbirdsall
Many thanks to you both again. I figured out the problem. In the upper left, I had to designate @gbcosgrove’s script as Java as opposed to Apple. Clearly a novice’s error. Now I’ve got both scripts – one that appends text to the note fields in selected items, and a similar one that also deletes the notes and replaces them with the next text. Both a huge help. Thanks!

It’s actually javascript, not java. They are completely unrelated and javascript is only named that because when it was crated java was really popular. If you go up to the gist up top that I put, it will clear out the note section and add whatever you put in. The second will just append. If you add these script to your OF scripts folder which you can access under the OF help menu. Then customize toolbar and you can just add the script there. Hope that helps.

Very helpful, thanks again!

What if I’d like to wipe out the old note contents when I run the script? Do I need a separate script?

Oh, sorry, I see that both types of scripts are already available at the links above, and they both work. This is excellent! I needed both. So it’s very, very helpful!! Thanks to all esp. @gbcosgrove and @chrisbirdsall !!