Gather @followup tasks across muliple TaskPaper documents (advanced script help)

(This post was redirected to this forum on a suggestion by Jessie) … In TaskPaper I save many different TP documents, each with a specific project in mind. Now I open up my main TP document and look at what I am working on. That involves several projects that have their own TP document as well as what I am trying to remember for the day. Since I can drag in any file of folder I am working on, this makes it super easy to go to each TP project and review that form the main TP page (just click on the link).

I would love to see TaskPaper search across all TP documents. Jessie, creator of TaskPaper and Folding Text, suggested there may be a person on this FT forum who is already familiar with this problem and may have a script that does this.

  1. The TP documents would NOT all be in the same folder. I have learned to create a more concrete file structure than I have had before. Now I am putting a TP document in project folders where I store and access documents for a specific project. IN that way I use my (Main) daily TP document to store each project area and link to that projects TP document. This is more for my organizational challenges - it doesn’t manage todo tasks very well - unless I can get help with this question.

  2. It would be nice if when checking @followup in my daily TP document I could see my @followup in any of my separate project TP documents.

  3. Results could be made to replace a Project designed for this purpose in my main dialy TP document. Or, they could be sent to a print out.

You can easily create a script to process all of your FoldingText or TaskPaper files using the cli program foldingtext. The command line:

find ~ -name ‘*.ft’ -print

will print the name of every file with the ft extension in your home directory. In a shell script, you could have:

echo -n "" > followup.tp
for file in (`find ~ -name '*.tp' -print`)
do
   echo "# [$file](file:///$file):" >> followup.tp
   foldingtext get "// @followup" $file >> followup.tp;
done

This would produce a file called followup.txt with every line in all TaskPaper files (files with the extension “.tp”) that has the @followup tag. To get a different directory, change the ~ to the path you want.

If you use Alfred, I just added this to my FoldingText workflow for Alfred. You can see the documentation for it here: http://www.alfredforum.com/topic/4468-folding-text-workflow/

It is on my GitHub account here: https://github.com/raguay/MyAlfred

Wonderful news. I don’t yet know what to do with your example though and I searched through your gethub link for … What exactly? Whats the name of that script?

Yes, I do use Alfred and Powerpack. Although I have not yeat learned how to customize Alfred.

Sounds like I am close to being able to enter a custom command in Alfred and run a script that checks and lists all my outstanding @followup tags - probably good to show what file each one is in too, and show the tasks so that I can print the list and review the tasks (and actually make progress).

Yippee!! (thanks)

David

Post Script: I have some rather severe organizational challenges (true). I can do some programming when I understand what I am doing but I don’t do well living too long in the logical side of my brain without a net. :wink:

CLI is … What? Are these JavaScript lines that I can run in Terminal?

Is your first example something that I can paste in a terminal window and hit enter - that simple? Am I understanding this so far?

ADDED: OK found that you probably mean using the new JAX in Applescript editor, yes? I Was not aware of this change in Yosemite. MY main Mac is still at Mavericks. IS ther anyway any of this will work in Mavericks?

Ref: http://www.macstories.net/tutorials/getting-started-with-javascript-for-automation-on-yosemite/

No need for Yosemite javascript – you pass the javascript lines to the FoldingText Command Line Interface (CLI) tool which you can install from:

https://www.npmjs.com/package/foldingtext

Okay. The following are commands for your terminal. Do you have node installed? If not, first install HomeBrew with:

ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

With HomeBrew, install nodejs:

brew install node

Now, install the nodejs program foldingtext:

npm install foldingtext -g

This should install the command line interface (cli) program called foldingtext. This program can search your FoldingText or TaskPaper files for tags. Now, download my Alfred workflows from GitHub: https://github.com/raguay/MyAlfred/archive/master.zip

When you unzip this archive, you will have the file FoldingTextWorkflow.alfredworkflow. Double click that file to load into Alfred. You can now use the different commands that the workflow provides. Many of the scripts in the forum are in this workflow. They are very useful. I use them almost everyday!

You will also want to install the Alfred URI workflow to be able to click on links in FoldingText to launch the files or directories. Explore the different items.

The commands for this part of the workflow are:

ft:setsearchtag
This is used to set the create tag files directory command for the Alfred browser. You can add as many tags to search for with this command or remove tags.

These next two are Alfred Browser commands you can invoke on directories in Alfred Browser:

Set Tag File Directory
This sets the current directory in the Alfred Browser to the directory for creating tag search files. One file for each tag is created in this directory with the search results.

Create Tag File
This will take the directory in Alfred Browser and search for files with the ft extensions. Those files will be search for lines that contain the tags set using the ft:setsearchtag command.

All of my Alfred Workflows are documented on my web site: http://customct.com/alfred-2-workflows

There is a list of tutorials I wrote on making Alfred Workflows at the bottom of that page. These will help you understand how to better use Alfred. It will also help you to explore the code I wrote for FoldingText so that you can make your own. I use a lot of zsh scripts, so you might want to study on zsh as well.

Have fun!

No need for Yosemite javascript – you pass the javascript lines to the FoldingText Command Line Interface (CLI) tool which you can install from: https://www.npmjs.com/package/foldingtext1

Went there, saw what the CLI was, saw who is maintaining it, could not find a download link. Found grey text with a download icon, non responsive “npm install foldingtext”

Is this where I have to create an account first and log-in, or am I missing something obvious?

Thanks

David

As Richard details,

npm install foldingtext

Is a command line which can be run in Terminal.app once npm has been installed, either directly, or with something like Homebrew.

OK, this is where I can get lost, skipping steps … I just installed Homebrew which appears to now allow me to run Ruby scripts in terminal which is really pretty cool. I don’t know Ruby yet but I was planning on learning it at some point.

The next question is going to be, how again am I to install NPM now that I have installed HB? As I mentioned, I cannot find a download link on that page? Fixed.

Updated: OK, I think I have everything installed, not sure.

  1. Installed homebrew
  2. Installed rpm
  3. Ran line: npm install foldingtext
  4. Terminal gave lines:
    ├── commander@2.1.0
    ── requirejs@2.1.15
    Is that it?

Thanks

David

I am still not seeing where this is added to the workflow that I think I have now installed? And using FT: in your Alfred flow is not referencing my TP parameters. Not sure how I should be tweaking this or what I should do next so see if this works.

I am still figuring this out, it should go to every file with the TaskPaper file designation of a specific hard drive and it should search for @followup and NOT Projects = Archive. OR for that matter, just “@” and Projects NOT equal Archive to see every active tag - assuming any use of tags is a verb and not a noun.

Example: @ and not Project = Archive

Would

I would love to know how this works. I have no clue where I should run this code or how to use CLI. IT is installed, thanks, but I am not understanding how to use it. I know this is Sunday morning and I attend church pretty heavily, I think some others do as well so I don’t expect to get a followup till later. Just a gentile reminder, not there yet.

Here is the following search string I would be looking for " @ and not Project = Archive", it covers all my tags that I am currently using (@followup, @task,@scheduled)

Much thanks

David

As I said in the previous post: First you install node (npm is the nodejs package manager). Therefore, after installing HomeBrew, you would install node with this in the terminal:

brew install node

That will install node (which is a JavaScript interpreter) and npm (the node package manager). Then, to install the tag searching program of Jesse, you would type this into the terminal:

npm install foldingtext -g

Now, the scripts in my FoldingTextWorkflow.alfredworkflow file will work. To download all of my Alfred Scripts, simply open this URL: https://github.com/raguay/MyAlfred/archive/master.zip

Once downloaded, double click on the file FoldingTextWorkflow.alfredworkflow to load it into Alfred. You can now set the extension looking for with “ft:setext”.

Actually, it might be easier to download the workflow from Packle: http://www.packal.org/workflow/folding-text-workflow

Helpful but not there yet. Yes, I installed all the tools as outlined in this thread. FWIW, Alfred workflows may not have been updated as I now tried your recent Packle download and at least I can type FT:getext and I get a response - sort of.

All it does, after pasting in your “ft:setext”, hitting enter, it spaces one character. I assume it is now up to me to type in what I want to search for through all my TP documents? typing “followup” I get a little Growl window letting me know that I have just done that… I look again and it is asking me to set my extension. For me this is not really necessary as I am only trying to compile your original post. After I Set the extension, nothing happens. No searching, nada. It just stops.

What am I missing here? How do I compile a custom solution that I want? Please.

Thank you

David

All of the commands here are typed into the Alfred prompt and not a command line.

To set the extension to tp, you would type:

ft:setext tp

If you only use one extension type, then you would simply set this once and not use this command again.

Then add some tags, for instance followup:

ft:setsearchtag followup

This command allows you to see all the tags you will be creating a report for. You can remove one by cmd and selecting a tag.

Then, navigate to the directory using Alfred browser. With the Alfred prompt visible, type ~. That changes to the Alfred browser inside your home directory. Select a directory to go to it.

First, set a directory for your reports. When you are at the directory, use right arrow and select “Set a Tag File Directory”. That is where the tag reports will be created.

When you are to the directory you want to start the search, hit the right arrow to show all the file actions and select “Create Tag Files”. Once it is finished, it will send you a notification. Then you can go to the directory that you set for the tag file reports and view them.

If you read all of my tutorials on writing Alfred workflows, you will understand how to look at workflows and get the commands from it. The FoldingText workflow has around 30 commands in it. There is a lot it can do and help your usage of FoldingText or TaskPaper.

I have a TBI (brain injury) and I am a little slow at organizing, PTSD issues don’t make it any easier for me. I am smart enough to follow directions - if they are broken down very slowly. It isn’t that I am not trying to follow directions, but each step has to give me a result I can understand. Otherwise I remain lost.

I use TaskPaper now for organizing what others probably take for granted. I use it to go to each area of my life that I am trying to function in (there are many). I am not even using TaskPaper yet for date reminders as that feels too complicated (yet).

I need help. I cannot do all this by just figuring it out. I very much appreciate what has already been shared so please do not see me as ungrateful or stubborn, I just don’t comprehend too much complexity all at once.

That is why I was asking for a one step solution that I could use to search through all TP docs on a specified drive (/Documents) and copy to a list every tag found that is not in archive. Something that I could trigger in Keyboard Maestro or launch from my desktop with an alias.

I am at a loss, I have already followed making the directory following the earlier instructions. Then I ran the Alfred command, also following earlier instructions. No new file was created in the directory that I had just I set it to.

I have also stumbled about, posting an AppleScript attempt …

At this point I don’t care to do this by specific tags, rather, I want to look at ALL TAGS so that I Can review ALL THINGS not done. As I said, I have rather severe organization challenges. That is why I am asking for help here.

Much thanks.

David

David,

This may be off topic here, but I use either a perl script to find tags in all FT documents, or it also works well with bbfind which is a command line tool for bbedit (commercial text editor). Effectively it just uses a regular expression to find what I am looking for, and with bbedit I can go straight to the entries I want and then open in FoldingText if I want.

If interested you can PM me and I’ll send you the script.


Mark

thanks, im sent. bbedit is at v 9.x, nice app but a little too complex for me, pearl scrip would be better

ADDED: Installed BBEdit command line features, looked at man pages, not making a lot of sense of it yet. BBedit cant run it from the “shebang” menu, gives error. Dont have a clue how to tell it to search all my TaskPaper docs, search for @ not in Archives and makes list of those lines.

Where did you go? I sent an email but no reply yet?