The action has an abbreviation set to ‘ap’. For the first time, have TaskPaper 3 open to the file with your projects. Open the Launchbar window (cmd-space for me), type ap, hit enter on the selection that says ‘TaskPaper - Add to Project’, type in the task description with any tags you want, press enter. It will then show a list of projects to add it to. Select one and it will be added to it. After it has saved the file location with the first activation, you do not have to have TaskPaper open for subsequent additions.
If it doesn’t show up on Launchbar’s Actions list, it most likely needs to rebuild it’s indexes. Right click on LaunchBar and select the menu Index → Update Index → All Rules. It should be accessible after that. Make sure the file is located here: ~/Library/Application Support/LaunchBar/Actions/TaskPaper - Add Project.lbaction.
Sorry, I didn’t see this question. Yes, it would be LB problem. For some reason it isn’t indexing the action. You’ll have to ask on their forum. Good luck. Very slow help there.
Here is a very simple scripting solution written in JavaScript for Automation (JXA) without any external dependencies.
Here the JXA script:
// Description: Quick entry script for TaskPaper app
var filePath = "~/gtd.taskpaper"; // Path to TaskPaper file
var appendItems = true; // If true, items will be added to the end rather than top of Inbox
function TaskPaperContextScript(editor, options) {
var outline = editor.outline;
var inbox = outline.evaluateItemPath("//Inbox")[0];
var items;
if (options.text && options.text !== "") {
items = ItemSerializer.deserializeItems(options.text, outline, ItemSerializer.TEXTMimeType);
}
if (!inbox) {
inbox = outline.createItem("Inbox:");
outline.root.insertChildrenBefore(inbox, outline.root.firstChild);
}
if (items) {
if (options.append) {
inbox.appendChildren(items);
} else {
inbox.insertChildrenBefore(items, inbox.firstChild);
}
}
}
var app = Application("System Events");
app.includeStandardAdditions = true;
var prompt = app.displayDialog("Location: " + filePath, {
withTitle: "TaskPaper – Quick Entry",
withIcon: Path("/Applications/TaskPaper.localized/TaskPaper.app/Contents/Resources/TaskPaper.icns"),
buttons: ["Cancel", "Save"],
defaultAnswer: "",
defaultButton: "Save"
})
var tp3 = Application("TaskPaper");
var isRunning = tp3.running();
var strFullPath = ObjC.unwrap($(filePath).stringByExpandingTildeInPath);
var document = tp3.open(Path(strFullPath));
document.evaluate({
script: TaskPaperContextScript.toString(),
withOptions: {text: (prompt.textReturned), append: appendItems}
});
document.save();
if (!isRunning) { tp3.quit(); }
Just set the filePath and appendItems variables on top of the script according to your needs. Depending on location of TaskPaper app on your machine, you would probably need to adapt path to TaskPaper icon as well (or comment this line out entirely).
Thank you. This is very useful. I made a Keyboard Maestro macro with this script and it works great. The only thing I had to change was the path to the TaskPaper icon.
Thanks @saf-dmitry for the original script and @Jim for the tweaks. Two questions:
I too created a KM macro to run this one for me, but with both running the script from KM and Script Editor, after execution (or during) it brings Taskpaper to the foreground - any idea on how to have this quick entry in the background?
Do either of you know how to get this working with a KM variable for the path? I’d like to add some logic for changing the path based on work or home taskpaper lists and then pass the path variable to the script. I stole the following from @complexpoint’s script, but I kept on getting an “The document “Test.taskpaper” could not be opened. The file doesn’t exist.” error from Taskpaper that the file was not found, even though the file and path are correct.
var kmVars = Application("Keyboard Maestro Engine")
.variables;
var filePath = kmVars.pathVariable.value(); // Path to TaskPaper file
...
I can’t remember if the Keyboard Maestro osascript interface changed at any point, but the usual way to read a value for a KM variable name would be with:
Odd. When I run it from Keyboard Maestro, TaskPaper stays in the background.
Here is the version of the script that I am running, on the chance that it helps:
var filePath = "~/Library/Mobile Documents/iCloud~is~workflow~my~workflows/Documents/Focus.txt"; // Path to TaskPaper file
var appendItems = true; // If true, items will be added to the end rather than top of Inbox
function TaskPaperContextScript(editor, options) {
var outline = editor.outline;
var inbox = outline.evaluateItemPath("//@type=project and @text matches[s] ^Inbox:")[0];
var items;
if (options.text && options.text !== "") {
items = ItemSerializer.deserializeItems(options.text, outline, ItemSerializer.TEXTMimeType);
}
if (!inbox) {
inbox = outline.createItem("Inbox:");
outline.root.insertChildrenBefore(inbox, outline.root.firstChild);
}
if (items) {
if (options.append) {
inbox.appendChildren(items);
} else {
inbox.insertChildrenBefore(items, inbox.firstChild);
}
}
}
var app = Application("System Events");
app.includeStandardAdditions = true;
var prompt = app.displayDialog("Capture what has your attention:", {
withTitle: "Ubiquitous Capture Tool",
withIcon: Path("/Users/jim/—ƒ—/Icons/TaskPaper3.icns"),
buttons: ["Cancel", "Capture"],
defaultAnswer: "",
defaultButton: "Capture"
})
var tp3 = Application("TaskPaper");
var strFullPath = ObjC.unwrap($(filePath).stringByExpandingTildeInPath);
var document = tp3.open(Path(strFullPath));
document.evaluate({
script: TaskPaperContextScript.toString(),
withOptions: {text: ("- " + prompt.textReturned), append: appendItems}
});
document.save();
Hey @complexpoint thanks for the help, although I get the same error as before. Not sure what the issue is there. Perhaps it’s elsewhere in the script then
Thanks @Jim. So what I actually noticed with mine is that it doesn’t bring it to the front per se, but rather if taskpaper is minimised it’ll unminimise it and then which back to whatever app you were working in.
Not sure if this is the same behaviour for you and your script (haven’t had a chance to try it yet), but either way an easy fix for me is to keep Taskpaper in full screen in another desktop