|
|
DevonThink is an information manager for OS X. Its main purpose is to
act as a repository for every document, image, video, and snippet of text
accumulated by the user. These contents are indexed, classified, and cross-
referenced, making for an ideal research tool.
DT Shell Commands
This package started out as a collection of shell scripts which interfaced
with DT via osascript. The first Applescripts were
Filter Through Command and Import Using
Command, the first intended to mimic the Textmate Text->Filter
Through Command feature, and the second intended to allow indexing of
file types which DT did not recognize, but which could be converted to plain
text using a command-line utility.
Within a short time, the package exploded into a veritable dumping ground
of Applescipts and shell scripts intended to add useful features to DT.
These are considered "power user" scripts (as evidenced by the heavy
use of command line utilities): the end user is expected to be versed
enough in OS X and the command line to recognize what the scripts could
be used for, and to have installed the requisite utilities (e.g. gnuplot
and Aquaterm).
Applescripts
Execute
- Filter Through Command :
Send DT Text record to STDIN of a command.
Import
- Convert Using Command :
Send DT Link record to command and create record from output.
- Import Source Code :
Create a Smart Record containing the syntax-highlighted
contents of a source code file.
Sheets
- Configure Plot Options :
Configure DT Sheet record for plotting.
- Plot Sheet Data :
Plot DT Sheet record with GnuPlot.
- Sheet From CSV Data :
Create DT Sheet record from DT Text record containing CSV data.
Smart Group
- Trigger Attached Script :
Trigger Applescript attached to a DT Smart Group or record.
Shell Scripts
- dt_add_comment.sh :
Append string to comment of DT record.
- dt_classify.sh :
List proposed classifications for DT record.
- dt_contents.sh :
Recursively list non-group children of DT record.
- dt_create_group.sh :
Create a DT group at specified location.
- dt_export.sh :
Export a DT record to a file.
- dt_get_id.sh :
Get the id of DT record at specified location.
- dt_groups.sh :
List group children of DT record.
- dt_import.sh :
Import a file into DT.
- dt_move_rec.sh :
Move DT record to specified location.
- dt_record_info.sh :
Display details of DT record.
- dt_rename.sh :
Rename DT record.
- dt_replicate.sh :
Replicate DT record to specified location.
- dt_search.sh :
Search for
- dt_set_label.sh :
Set label of DT record.
- dt_smart_rec.sh :
Trigger (and optionally attach) the script of a smart record.
- dt_sync_rec.sh :
Synchronize DT Link record with file system.
- dt_take_note.sh :
Import STDIN to DT via clipboard.
Download DT Shell Commands
Installation
To use DT Shell Commands, the Applescript files must be installed in the
DT script directory, and the shell scripts must be installed in the
path.
The recommended procedure is to copy the contents of
Scripts/Execute,
Scripts/Import,
Scripts/Sheets, and
Scripts/Smart Group to the equivalent directories
in ~/Library/Application Support/DEVONthink Pro,
where ~ is the user home directory. The contents of
shell can be copied to any directory in the path,
such as ~/bin or
/usr/local/bin (neither of which is in the OS X
path by default, so the shell config file ~/.bashrc
must be modified); a more OS X-style location would be
/Users/Shared/bin, which also must be added to the
path.
Examples
| Import unrecognized text file |
When a file is not recognized as a Text document by DT (e.g. when it does not
have a .txt extension), a Plain Text record can
be created for it by selecting the Link record created by DT and running
Import Using Command with the command
cat $FILENAME.
|
| Plot numbers in a text file |
Select the numbers to be plotted. For this example, the input will be the
following text in a DT Text record:
2002 Numbers
January : 676
Feb: 102
March: 250
April: 331
May: 475
June: 220
July: 209
August: 78
Sept: 501
Oct: 320
Nov: 298
Dec: 405
2003 Numbers
January: 701
Feb: 80
March: 319
April: 456
May: 508
June: 276
July: 179
August: 188
Sept: 587
Oct: 332
Nov: 211
Dec: 372
Select this text and run Filter Through Command",
with the command
grep '^[A-Za-z ]\+ *: [0-9]\+$' |
(echo 'Month, Yield' ; cat -n) |
sed 's/^ *\([0-9]\+\) *[^:]*: /\1,/'
and the output option New Record. This will create
a DT Text record containing the data in CSV format, with the months replaced
by numbers (1-24). Select this record and run
Sheet From CSV Data; this will create a DT sheet
record for the data in the generated Text record (which may be safely
deleted). Select the Sheet record and run
Plot Sheet Data to plot the data.
|
| Import a source code file |
Run Import Source Code with no items selected.
Choose a source code file to import. An HTML record for the file will
appear in the root of the database.
|
| Create a DT smart group for the phrase "Power PC" |
dt_create_group.sh "/Power PC" -x -s
"$HOME/Library/Application Support/DEVONthink Pro/Smart Group/BPhrase.scpt"
|
Release History
- 1.1 (08/28/06) : Removed Import CSV Data, Added Sheet From CSV
Data, Import Source Code, dt_add_comment.sh,
dt_create_group.sh, dt_get_id.sh,
dt_move_rec.sh, dt_replicate.sh,
dt_set_label.sh, dt_smart_rec.sh, and
dt_sync_rec.sh. Added -r option to
dt_contents.sh and dt_search.sh.BUGFIX
of plotting scripts and import source code
(1.1a).
- 1.0 (08/25/06) : Initial release.
Useful Links
License
DT Shell Commands is released under the
BSD license.
The BSD License
Copyright (c) 2006, Eric Fedel
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice and either a) this
list of conditions and the following disclaimer, or b) a link to a document which
contains this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or other materials
provided with the distribution.
* The name of the copyright holder may not be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
|