What's the latest on "Quick Entry" solutions for TaskPaper 3?


#21

I just created and uploaded a new Launchbar action as suggested above. You can get it from my GitHub account: https://github.com/raguay/MyLaunchBarActions

This action is used to add a new task to a TaskPaper project. If you send a path of a TaskPaper file to this action, it stores that path to add tasks to. Otherwise, if TaskPaper is running while you run this action, it will get that files path, store it, and use that file. If you run the action again when TaskPaper isn’t running, it will use the last stored file name.

Once it has determined what file to use, it asks the user for the task line and which project to add it to. The user simply types the name of the task, and selects the project. That new task will be added to the top of that project.

This action just modifies the text file. It doesn’t go through the TaskPaper API. I did it that way so that TaskPaper doesn’t have to be running.

Let me know if this works well for your use case.


#22

This is great!! I’ve tried it and it works great! (Finally some Launchbar goodies - I’m surprised of how many Keyboard-Maestros there are here.)

Only one remark: After entering the text/task, selecting the project and hitting enter, the task gets added at the perfect spot - only my launchbar-bar stays afloat.
If I then hit enter again to make it disappear, I get the same task twice - or I have to hit ESC, which works. But maybe you can make the launchbar-bar go and/or have another type of feedback, eg. a notification: Task X added.

But besides - this is awesome and makes me like TaskPaper+Community so much more :wink:


#23

Yea, I finally figured it out. If I do not use a LaunchBar internal command with the action, it doesn’t close the bar. I now have a dummy command in there and the bar closes properly. You will have to redownload it and re-install it.

I’ll be adding this to my Alfred TaskPaper workflow. It has even more actions: A monthly, weekly, daily task adding with possible repeats. It is my complete todo list workflow, but I have a small bug in it that I am trying to work out first.

I use both LaunchBar and Alfred (I know, I’m weird. A true gadget freak!). So you can bug me with questions about either.


#24

Useful work ! Many thanks for sharing this.

There may be scope, I think, for refining the project listing a little. At the moment, if we take, for example, the standard test file, and add a @due date to the To Organize Items: project, we hit a couple of minor problems:

  1. The code loses one of the projects (it doesn’t yet have a mechanism for recognising the project colon when it’s followed by a tag)
  2. The code thinks that the last project, To Fold, Focus, and Filter Items: is three different projects (it gets confused by finding commas in the project name)

The only other comment is that I did hit an error message a few times before I figured out how to set the default project path : - ) ( but that’s probably my fault … maybe just a little more text on it in the documentation ? )


#25

Yes, I am currently searching for lines that end in “:” to be projects. I guess I need to make that search more generic. First pass and adding new features…

What error are you getting? If you have TaskPaper already open with a file, it should query TaskPaper for the file path and use it. Or, you can navigate to the file in LaunchBar and use the “Send To” feature (tab on the file) and then select the action using tpa (or the abbreviation you have trained in). Either way should save the file to use for adding items.

I only use tags like that on items and not projects.


#26

If you’re using (presumably) regular expressions to identify projects, you might want to look at the ones in my TaskPaperRuby code. They do recognise projects containing commas, or ending with one or more tags. There’s also a regexp to right-strip groups of tags from lines.

The regexps are in the TaskPaperItem class.


#27

What error are you getting? If you have TaskPaper already open with a file, it should query TaskPaper for the file path and use it.

Your code probably needs to handle the case where ~/.tpProjectFile doesn’t yet exist.

(Users are quite likely to hit that case when they first try to use the action).


#28

Just updated to fix that use can. Projects are now anything that doesn’t start with a ‘-’ and has a ‘:’ somewhere in the line. I tried using Regular Expressions, but they made the script run much slower. Doing spot checks like this runs a whole lot faster. You will need to redownload from the GitHub Repository.


#29

That might catch notes that use colons, too. Projects are lines that don’t start with "- ", and whose last (rightmost) non-tag-or-whitespace text ends with a colon. Runs of tags and/or whitespace after the colon don’t disqualify a line from being a project, but any other text does, making it a note instead.

Here's an example: this line should be a note, even though it has a colon.

But this is a project: @today @flag

#30

Okay. I was able to get a good RegExp version that seems to work. @mattgemmell’s RegExp would not work in JavaScript.

I also was able to get proper error messages if there isn’t a designated file or TaskPaper isn’t open.

It is on my GitHub. Please give it a try and let me know if there are any other issues.


#31

Quick progress !

There still seems to be a difficulty in getting or using the path of a saved file in the active document on first use (perhaps still because of the initial absence of ~/.tpProjectFile ?)

On using regexes – you mentioned performance – I notice that you are compiling a fresh regex in each iteration of the inner loop. You may find it more run-time-efficient to create the regex once (outside the .forEach process) bind a variable name to it, and then use that name inside the .forEach() function.

Good luck !

PS - UPDATE

just took a closer look - I think you may find, if you insert a debugging alert, that your LaunchBar.executeAppleScript call is returning an empty string in lieu of an active document filepath:

    var pFile = LaunchBar.executeAppleScript('if application "TaskPaper" is running then',
        'tell application id (id of application "TaskPaper")',
        '	set a to file of the front document',
        ' 	return POSIX path of a',
        'end tell',
        'else',
        '	return ""',
        'end if').trim();

    LaunchBar.alert('Path returned: ->' + pFile + '<-');


#32

That happens if the file is in a sandboxed location that I can not access or has not truly been saved to the file system yet. I’ve never ran across a case where that would not give a path other than for the mentions cases. I’ll keep looking into it.

I’m moving it out and it does help (the RegExp). I’ll post the new version tomorrow. It’s late here in Thailand. :smile:


#33

It also depends, of course, on the process which runs the script. If you try running AppleScript code of increasing curiosity and ambition from that LaunchBar.executeApplescript() method, I think you may find that you get as far as persuading the TaskPaper Application to reveal its name, but that it will withhold the number of documents that are open.

It may prove simpler to forgo the convenience of the LaunchBar methods, and run your JavaScript in a JavaScript for Automation context (rather than a LaunchBar engine context), by choosing ‘AppleScript’ as the type of the default script in LaunchBar’s Action Editor, and supplying it with a JavaScript for Automation .scpt.

(That might also spare you from calling out to smaller osascript fragments here and there)


#34

Hi, Just updated the LaunchBar action to run a little faster. Not sure about doing @complexpoint suggestion as I can’t reproduce the problem and I do not know that much about that flavor of JavaScript (like how to read files from it).


#35

I would like to see an Alfred app version of this this script. Would that be very hard to do?


#36

Yes, I am adding it to my Todo Workflow which you can get here: https://github.com/raguay/MyAlfred

I’m still working on a few bugs with it, but I should have it added by Monday Thailand time. I’ll announce it here as well.


#37

Just added it to my Todo Workflow for Alfred. You can download it from Packal (http://www.packal.org/workflow/todo-workflow) or my GitHub account above. It is the t:addtask command.


#38

Great! Thank you. Will try it.


#39

The workflow doesn’t seem to work on my machine: t:settodo is not responding


#40

t:settodo requires you to start typing the name of the directory you want your todo list directory made. Therefore, if you type “docum”, it should give the ~/Documents" directory as an option. I place it in a Dropbox folder and use it on two computers. Very handy!