Jump to content

Quiver Workflow


Recommended Posts

Quiver Workflow

 

This workflow allows you to create templates with Handlebar syntax inside of the Quiver program. To use the workflow, you have to have Node.js installed first. I recommend using [Homebrew](http://brew.io) to install it. You need to make sure you have Node.js 6.0+ on your system. As of this update, I am using node.js 6.6. With the node program installed, set the environment variable nodeProg to the right to the directory path of the program. If you used HomeBrew, it should be "/usr/local/bin/node".

Once Node.js is installed, go to your Quiver Library file in Alfred Browser and select the “Set Quiver Library” file action. This tells the workflow where your templates (or snippets) are to be kept. Create a workbook called “Snippets” with one note called Defaults. The Defaults note has to have one code block set to JSON and the defaults for the Handlebar expansions set. The rest of the notes will be templates.

When you run “qt”, it will list all of your snippet in the Snippets notebook. When you select one, it will be expanded with any json cell the note and the Defaults json note data.

There are several special helper function for Handlebars defined. They are:

{{userfillin <text>}}
The user will be asked for the value of the text to be inserted at that point in the snippet. This gives a way to add text to a snippet upon expansion.

{{clip <num>}}
This command will get the specified clipboard entry and put it in it's place. The <num> starts at 0 for the previous clipboard. The environment variable clipHist defined to the right will determine how far back in history of the clipboard will be retrieved. The larger the number, the slower the program is running.

{{env <variable name>}}
This command will get the environment varable specified and put it in it's place. Therefore, the macro {{env "alfred_workflow_data"}} will put the contents of the alfred_workflow_data environment variable in it's place.

{{save <name> <text>}}
This command creates a helper named “<name>” with the expanding text of “<text>”. It also places the given “<text>” at the point of definition. This allows you to create text snippets on the fly inside the template. Very handy.

{{clipboard}}
This helper command places the current clipboard contents at the point in the template.

{{date <format>}}
This will format the current date and time as per the format string given. See the help document that is loaded upon initialization.

{{date <date/time> <format>}}
This takes the date/time string and formats it according to the format given.  See the help document that is loaded upon initialization.

{{copyclip <num>}}
Inserts the copyclip <num> into the location of the macro.

The following data expansions are defined as well:

{{cDateMDY}} gives the current date in Month Day, 4-digit year format

{{cDateDMY}} gives the current date in Day Month 4-digit Year format

{{cDateDOWDMY}} gives the current date in Day of Week, Day Month 4-digit year format

{{cDateDOWMDY}} gives the current date in Day of Week Month Day, 4-digit year format

{{cDay}} gives the current date in Day format

{{cMonth}} gives the current date in Month format

{{cYear}} gives the current date in 4-digit year format

{{cMonthShort}} gives the current date in Short Month name format

{{cYearShort}} gives the current date in 2-digit year format

{{cDOW}} gives the current date in Day of Week format

{{cMDthYShort}} gives the current date in Month day 2-digit year format

{{cMDthY}} gives the current date in Month Day 4-digit year format

{{cHMSampm}} gives the current date in h:mm:ss a format

{{cHMampm}} gives the current date in h:mm a format

{{cHMS24}} gives the current date in H:mm:ss 24 hour format

{{cHM24}} gives the current date in H:mm 24 hour format

You can also specify an area to split up the expansion using the "%|% character. If the "%|" characters are in a clip, the first part is pasted directly while all the other parts are put into copy clips starting at 1. You can then paste each part by pasting the corresponding copy clip.

This workflow has the feature to save and paste copy clips: clips of text. You assign each clip a name (ie: 1, 2, a, b, life, etc) when you save it. It is kept until you save on top of it again. You copy and paste using a hotkey (I use ctrl-c and ctrl-v).

 

 

 

Version:     3.0

 

 

Date:          07/04/2017

 

 

 

 

 

Edited by raguay.customct
Link to post
  • 3 months later...

Can you please select the debug option on the script filter and post the output. That output will tell me whether or not this is a problem that I was somewhat wondering if it would happen.

 

I think I know what the issue might be. I am compiling a Haskell program to get the different snippet names from the library. I have a large number of snippets and the interpreted version was too slow. I believe it isn't able to find the dynamic loading library files on a system without Haskell. I developed the program with the Haskell for Mac IDE, but I can't get it to produce a static link image. Working on it.

 

Also, you might check to see if Alfred can see your node.js install. The ~/Library/Application Support/Alfred 2/workflows/com.customct.QuiverWF/node.txt should point to the program. Check to make sure it is.

 

It good to know that someone else is trying the workflow! Thanks for the feedback.

Edited by raguay.customct
Link to post
I just did a major update to this action. The new features are:

 

1) Paste through Keyboard Maestro (expanding the %| cursor placement macro).

2) Added the next Handlebar helper for doing relative dates (see the new help file).

3) Added the ability to hook into the Handlebar template engine by adding a JavaScript cell in the Defaults notebook. Now you can add your own helper functions. (see the new help file and new defaults file for examples).

 

You will need to redownload from Packal and reinstall the help files to get the new documentation. I'm having a lot of fun with this one and making many templates (over 100 now).

Link to post
  • 4 months later...

Thanks for sharing this workflow.

 

The instructions are not clear to me, so I am having trouble getting this to work.

 

What do you mean by, "Once Node.js is installed, go to your Quiver Library file in Alfred Browser and select the “Set Quiver Library” file action."

 

I have Node.js installed, so I am specifically wondering about, "go to your Quiver Library file in Alfred Browser".

 

I have no idea what this means. Would you please elaborate?

 

Thank you,

 

Jonathan

Link to post

Open Alfred and type ~. That will show the Alfred Browser window at your home directory. Go down the directory until you get to the Quiver library file. With that file highlighted, right arrow and select the action "Set Quiver Library".

Edited by raguay.customct
Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...