-
Notifications
You must be signed in to change notification settings - Fork 12
Example Uses
Simulate the creation of a new note:
$ paperless --simulate create document.pdf
OCR and prompt for renaming the file:
$ paperless create --ocr --prompt document.pdf
Define a separate rules file and OCR:
$ paperless --rules_file=/MacHD/rules.txt create --ocr document.pdf
Hazel is a great tool. Here is the steps that you need to follow in order to use paperless inside your hazel rules.
-
As a part of the action for your Hazel rule, you are going to set the action to
Run shell script
. -
Set option to
embedded script
. -
Clikc on the edit script button and paste in the below script.
source ~/.paperless.rc paperless create --ocr $1 >> ~/paperless.log
Thats pretty much it! Let's analyze these 2 lines so that you can get a better idea of what is going on here.
This command tells Hazel where to find the Paperless libraries. Without it, the paperless command would not be found.
The .paperless.rc
file gets created for you if you used the Paperless Installer when you did the initial installation.
For the geeks that did not use the installer, this file simply sets up the RVM environment and the PATH variables. Here is the contents of that file.
source ~/.rvm/scripts/rvm; PATH=~/.rvm/bin:$PATH
The command used here does the barebones basics, I recommend that you read up on the command usage documentation so that you know what options you may want to use here.
The $1
in that command inserts the name of the file that will be processed by paperless.
You will notice the >> ~/paperless.log
at the end of the commmand. This is a nice way to send the output of the paperless command to a text file so that you may look at it to help you debug things.
Tip: If you add the --dump option to the command, then the OCR text from a document will be sent to the log file as well. This is useful if you are trying to figure out why a particular file is not getting matched by a rule. You may also want to turn on simulation mode so the file does not get archived away.