This is exciting!  Thanks Christiaan!

I have two questions.

* At 
https://hookproductivity.com/help/integration/creating-integration-scripts/ 
<https://hookproductivity.com/help/integration/creating-integration-scripts/>, 
it says that "A document must always produce the same URL even if the document 
is moved renamed or edited."  The script below will not meet that requirement 
if the cite key changes.  Should we rather use the DOI of an entry as the 
primary URL, if the DOI is present?  (The scheme you suggested (using the cite 
key) could be a backup scheme when no DOI is present.)

* At present, the script below works when a BibTeX entry is the frontmost 
window.  Could the script be made to work when the .bib window is the frontmost 
window and a single row of the .bib file is selected?  (If no row of the .bib 
file is selected, it seems that the entire .bib file should be linked.  In 
fact, that is the current behavior.  Yay!)

* Should the URL returned by this script also encode an identifier for the .bib 
file in which the entry is embedded?  It seems like Hook will need to know 
which .bib file to open before finding the entry within that .bib file.

* If a .pdf is selected in the BibDesk UI, would it be possible to return a URL 
for that file in the OS?



There are a couple additional steps to complete Hook integration, but we are 
already getting close!  I think I could write the scripts below, after we 
finalize the URL scheme. 

* Another required script is an Open Item script, which will need to parse a 
URL and open that entry in the BibTeX file.  The Open Item would possibly first 
open the .bib file then open the linked entry within that file.

* The final (optional) script is a New Item script.  I think I could write that 
one that invokes the New Publication item from the Publication menu.


Thanks for the quick work, Christiaan.  I'm eager to hear your thoughts on my 
questions above. 

Cheers,

Matt







> On Nov 29, 2020, at 10:40 AM, Christiaan Hofman <[email protected]> wrote:
> 
> sorry, there was an error in that script. Here’s the corrected one:
> 
> 
> tell application "BibDesk"
>     set the_pub to publication of front window
>     tell front document
>         if the_pub is missing value then
>             set the_pubs to its selection
>             if count the_pubs is 1 then
>                 set the_pub to get item 1 of the_pubs
>             end if
>         end if
>         if the_pub is not missing value then
>             set the_name to title of the_pub
>             set the_url to export using text 
> "<[email protected]/>" for the_pub
>         else
>             set the_name to its name
>             set the_url to file URL of its file
>         end if
>     end tell
>     return "[" & the_name & "](" & the_url & ")"
> end tell
> 
> 
> Christiaan
> 
> _______________________________________________
> Bibdesk-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bibdesk-users

_______________________________________________
Bibdesk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-users

Reply via email to