If you find yourself running your text files through UNIX filters, UnixServices may be for you. UnixServices allows you to send your current selection to any command line program that can process standard input. If the service returns output, the output replaces your current selection.
Services are a much under used technology dating back to NeXTSTEP (where they were much more prevalent) that allows a program to export its features and functions to other applications via the pasteboard. Most applications sport a Services menu where the system lists all currently applicable services. For example, by selecting text, images, urls, or other kinds of data, your system will update the Services menu to show appropriate services that operate on the kinds of data that you are working on.
My main motivation was to externally enhance some text processing needs I have. Instead of providing a single use solution that required me to change the program when my needs change, I decided to write an extensible services framework. So for example, my UnixServices entries add commands to:
UnixServices is work in progress but it already extremely useful to me, and I bet you too. If you are not UNIX savvy, I recommend that you get a book that teaches you how to harness the wealth of UNIX tools, you will find there are many little things that are powerful, neat or useful. UnixServices simply enables you to use them right in your favorite apps.
|1. Add a new service. Configure its title,|
executable and arguments
|2. Set the pasteboard send types|
|3. Set the pasteboard return types||4. Save the service|
|5. Use your service from other applications!|
You can group related services by providing a menu path. For example the services in the screen shot specify Unix/serviceName which creates a top level menu called Unix. Your command can specify an arbitrary number of levels separated by slashes. Note that there are no leading slashes in the title. The last item in the title path is the name of the command: Developer/Code Formatting/Comment Selection.
Pasteboard send and return types provides the information that the system uses to show and validate the command on specific selections. Services with no send types don't consume text. Services with no return types don't change the selection.
If your service is not showing on the Services menu, either the application doesn't support the specified send/return type, or there's a misconfiguration of this setting in your service specification.
Here's a list of an useful configuration that I always find handy. For more information on what the commands do, simply consult their man page.
The unix format command /usr/bin/fmt reflows text into an ideal paragraph width. For arguments I like to specify: -s which collapses whitespace inside of lines.
For this I use /usr/bin/tr, with the following two arguments: "[:lower:]" and "[upper:]". To do the opposite, and convert it all to lowercase, simply flip the order of the arguments to: "[upper:]" and "[:lower:]".
To create a list of words from some text: /usr/bin/tr, with the following three arguments: -cs [A-Za-z] \n.
To sort /usr/bin/sort with the argument -f.
If you have a sorted list, such as one created after running the Sort command above, you can unique all the lines with /usr/bin/uniq. For extra fun try, word list, sort, unique.
To display invisible characters, /usr/bin/vis with the arguments -w -l -f. To remove characters expose by vis, simply specify the command /usr/bin/unvis without arguments.
If this software is useful, donate!
Report Bugs to SmartSoft
Copyright @2004 SmartSoft.COM