Ok all done! Thanks for those who supplied some tips. With this AppleScript
and a working pdfmeat.py (test it from the command line), I can drag a PDF
into BibDesk, select it, and populate it with all of the data from Google
Scholar.

  -k.

*property* useFileURL : *true*

-- use relative or absolute path?

*property* useRelativePath : *false*

-- delete linked files/URLs after converting?

*property* deleteLinkedFiles : *false*


*tell* *application* "BibDesk"

*set* theDoc *to* *document* 1

*tell* theDoc

 *set* theSel *to* selection

 *set* thePub *to* *item* 1 *of* theSel

 *tell* thePub

 -- current (probably empty?) BibTeX record

 *set* curBibTeXRecord *to* *get* BibTeX string *of* thePub

   -- get the BibTeX record using pdfmeat.py. Wrap it in a shell script
because it needs a full path, write access to a folder, etc.

 *set* theFile *to* *get* *linked files*

 *set* thePath *to* POSIX path *of* theFile

 *set* shellOpts *to* "cd /tmp; PATH=$PATH:/usr/local/bin " -- path to
pdftotext program

 *set* pdfMeatCmd *to* "/path/to/python /path/to/pdfmeat.py  "

 *set* shellCmd *to* shellOpts & pdfMeatCmd & "'" & thePath & "'"

*set* pdfMeatOutput *to* *do shell script* shellCmd

*end* *tell*

  *set* newPubs *to* *import* from pdfMeatOutput

 *set* newPub *to* (*get* *item* 1 *of* newPubs)

 *tell* newPub

 *make* new *linked file* with data theFile at *beginning* *of* *linked
files*

 *set* cite key *to* generated cite key

 *end* *tell*

  *show* thePub

 *show* newPub

 --delete thePub

*end* *tell*

*end* *tell*
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Bibdesk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-users

Reply via email to