Has anyone come up with a script or workflow that would allow me to copy some projects/notes/tasks from taskpaper and paste them into my email client Apple Mail, Airmail, etc… and have the text be converted into a bulleted list?
I find myself using Taskpaper to capture meeting notes however it’s turning into a real PITA to try can share those notes out through email without having to convert the outline to a bulleted list and then manually fixing the indentation.
I’m not sure how your email client will handle this, but try this script:
function SelectionToBMLTaskPaperContextScript(editor, options) {
return ItemSerializer.serializeItems(editor.selection.selectedItems, { type: ItemSerializer.BMLType })
}
let taskPaperApp = Application("TaskPaper")
taskPaperApp.includeStandardAdditions = true
let selectionAsBML = taskPaperApp.documents[0].evaluate({
script: SelectionToBMLTaskPaperContextScript.toString()
})
taskPaperApp.setTheClipboardTo(selectionAsBML)
It will convert the selected items in your TaskPaper document to BML (which is a subset of HTML) and put that text on the clipboard. So run the script and then paste into your email client and see if that works.
Is there a way to do the opposite when you have a bulleted list or hard return list from an email and convert them all to tasks? I just finally upgraded to TaskPaper 3 through the App Store hoping for that feature since it looked like it had so many more key commands.
There is a list of different ways to do this in the Wiki. If this is something you are planning on doing ofter, I would recommend you to do it using the Ruby Library. This is because you can do that with a script that runs every whenever you want using “jobs”. There is an explanation on how to do that in one of the script pages in the wiki. If you are interesting on it, try reading those links and I can help along. Just create another post with your questions and tag me.
I just posted a thread asking to create numbers or bulleted lists in TaskPaper. My current workaround is to copy what I want to put in a list in TaskPaper, paste into Notes, format the list, copy it again and paste it back into my TaskPaper document.
Should this still work? When I run this script and paste into Drafts or Bear, it gives me gobbledegook. I’m using the current version of MacOS. Thanks!
The script is still working for me, but it is intended to generate HTML code, which probably Bear doesn’t handle specially, and the end result is gobbledegook.
In the case of Bear I think just copy/paste TaskPaper lists is probably your best bet? If you can explain a bit more on what exactly you want your list to look like in Bear I can try offering other ideas.
@jessegrosjean Circling back on this request. Is there a simple way to do this that I’m missing? Being able to do my initial writing/outlining in TaskPaper and then being able to copy that work and paste it into another plain text-based program for easy sharing with others would be really handy. Thanks.
var TaskPaper = Application('TaskPaper')
function TaskPaperContext(editor, options) {
let outline = editor.outline
let selection = editor.selection
let currentItem = selection.startItem
let result = ""
for (each of currentItem.branchItems) {
result += "\t".repeat(each.depth - 1)
let type = each.getAttribute("data-type")
if (type == "task") {
result += "- [ ] " + each.bodyString.substring(2)
} else if (type == "note") {
result += "- " + each.bodyString
} else {
result += each.bodyString
}
result += "\n"
}
return result
}
var text = TaskPaper.documents[0].evaluate({
script: TaskPaperContext.toString()
});
TaskPaper.includeStandardAdditions = true
TaskPaper.setTheClipboardTo(text)
This is fantastic! It works as long as my cursor is at the top of the TaskPaper page (assuming I want the entire list to be copied). I don’t really know what I’m doing with scripting and workflows, but I made an Alfred workflow that will use a hotkey (in this case it involves my caps lock remapped to Shift+control+option+command), move the cursor to the top of the TaskPaper page, run your script, open a new Bear note, and paste the list into Bear, formatted perfectly. Thanks so much! Taskpaper to Bear.zip (2.2 KB)