Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- #/home/clockworkpc/bin/pdfsearch.py
- # Released under a GPLv3 Licence by Clockwork PC 2012
- # www.clockworkpc.com.au
- # You are entitled to the following four freedoms:
- # Freedom 0: To run this program for any purpose
- # Freedom 1: To study how this program works and change it to make it do what you wish
- # Freedom 2: To redistribute copies so you can help your neighbour
- # Freedom 3: To distribute copies of your modified version to others
- import os
- import subprocess
- #Get folder using Zenity GUI
- proc = subprocess.Popen('zenity --file-selection', shell=True, stdout=subprocess.PIPE, )
- output = proc.communicate()[0].strip()
- searchFolder = output + "/*.pdf"
- #Define the search term and prepare the Shell command for the commandline application pdfgrep
- searchTerm = raw_input("What is the search term? ")
- searchPrefix = "pdfgrep -i -H -n "
- searchCMD = searchPrefix + '"' + searchTerm + '" ' + searchFolder
- print searchCMD
- #Execute pdfgrep
- os.system(searchCMD)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement