A Snippet and supporting Ruby scripts for generating sequences in TextExpander on OS X.
This is essentially just the README from the github project I link to at the end, so you might want to skip straight to that instead.
This might be a particularly esoteric problem, but bear with me. I have a particular hatred of typing numbers for lists, for example bullet points, SKU codes, etc. It's horrible having to type
1 ~blah, blah~
2 ~blah, blah~
3 ~blah, blah~
....
99 ~blah, blah~
Ick.
It gets even worse if you're typing Roman numerals, or formatted SKU codes, or whatnot.
Autogenerating list items is a feature absent in most simple editors, and even full-featured ones can have trouble with complex sequence rules. This Snippet gets round this by giving access to a persistent sequence that can be called from a triplet of keyboard triggers, and easily extended with simple Ruby classes to cope with the most bizarrely formatted numbers.
First, you'll need the uuid gem installed
$ sudo gem install uuid
After that, download the zip from github. Import Sequence.textexpander into TextExpander. Move the rest of the files into ~/Tools/TextExpanderScripts/textexpander-sequence/ or update the Snippets to point to wherever you've put them.
In any application type:
By default, the Snippet sets up a single sequence. To set up more, copy the group in TextExpander and change the first argument to sequence_runner.rb:
#!/bin/bash ruby ~/Tools/TextExpanderScripts/textexpander-sequence/sequence_runner.rb OTHER_SEQUENCE restart
A Formatter object is used to transform the sequence before output. The default is just to print out the number with no transformation. There are currently two sample Formatters:
To change the formatter you'll have to change the constructor to Sequence in sequence_runner.rb.
sequence = Sequence.new(ARGV[0], RomanNumeralFormatter.new)
...will generate...
I One
II Two
III Three
IV Four
As I say, a very specific scratch for a very specific itch, but I hope you find it useful. You can download all the files from textexpander-sequence on github
Commenting is currently enabled. There are 0 comments so far.
Leave a Comment