Converting Local-Url-N links

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Converting Local-Url-N links

macula

Hi,

I am trying to import a large BibTeX database into BibDesk. I have painstakingly entered all attachments to each entry as a list of Local-Url-N fields (Local-Url, Local-Url-2, Local-Url-3, etc.). Most references have only one attachment, some two, and very few well over ten.

But I am confronting two problems:

  1. BibDesk fails to find some files even though the paths are clearly correct.

  2. BibDesk completely ignores all Local-Url-N fields (N=2,3,…), and only recognizes Local-Url.

Any ideas as to how to proceed? Thank you.


------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Bibdesk-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bibdesk-users
Reply | Threaded
Open this post in threaded view
|

Re: Converting Local-Url-N links

Christiaan Hofman

On Jun 13, 2014, at 11:18, ir299 wrote:

Hi,

I am trying to import a large BibTeX database into BibDesk. I have painstakingly entered all attachments to each entry as a list of Local-Url-N fields (Local-Url, Local-Url-2, Local-Url-3, etc.). Most references have only one attachment, some two, and very few well over ten.

But I am confronting two problems:

  1. BibDesk fails to find some files even though the paths are clearly correct.

  2. BibDesk completely ignores all Local-Url-N fields (N=2,3,…), and only recognizes Local-Url.

Any ideas as to how to proceed? Thank you.


Only fields that are known as local file fields (as declared in the Fields preferences) are (automatically) converted to linked files. So you should also declare the others there if you want to get this. Note that if you already have the first one converted, it won't automatically convert the others later on (it only automatically converts for items that don't yet have linked files.)

Christiaan


------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Bibdesk-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bibdesk-users
Reply | Threaded
Open this post in threaded view
|

Re: Converting Local-Url-N links

Jan Jakob Bornheim

Hi,

I am trying to import a large BibTeX database into BibDesk. I have painstakingly entered all attachments to each entry as a list of Local-Url-N fields (Local-Url, Local-Url-2, Local-Url-3, etc.). Most references have only one attachment, some two, and very few well over ten.

But I am confronting two problems:

  1. BibDesk fails to find some files even though the paths are clearly correct.

  2. BibDesk completely ignores all Local-Url-N fields (N=2,3,…), and only recognizes Local-Url.

Any ideas as to how to proceed? Thank you.


Only fields that are known as local file fields (as declared in the Fields preferences) are (automatically) converted to linked files. So you should also declare the others there if you want to get this. Note that if you already have the first one converted, it won't automatically convert the others later on (it only automatically converts for items that don't yet have linked files.)

Something like this should work as an AppleScript (provided the Local-Url is an absolute POSIX path). Warning: It might need some  more tinkering. I don’t actually have a database to test it on. On the plus side, it will only iterate through the currently selected publications, so it shouldn’t mess up your entire database.

tell document 1 of application "BibDesk"


set thePubs to selection


repeat with thePub in thePubs


tell thePub
set i to 0
set theRepeat to true
repeat while theRepeat is true
if i is 0 then
set theField to "Local-Url"
else if i is greater than 0 then
set theField to "Local-Url-" & i
end if


if i is equal to 0 then
set i to i + 2
else
set i to i + 1
end if


set theFile to value of field theField


if theFile is "" then
set theRepeat to false
else
set theFile to POSIX file (value of field theField)
add linked file theFile
end if
end repeat
end tell


end repeat


end tell

Jan Jakob


------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Bibdesk-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bibdesk-users
Reply | Threaded
Open this post in threaded view
|

Re: Converting Local-Url-N links

macula
In reply to this post by Christiaan Hofman

Christiaan, thanks for the tips, it all works as expected. First day with BibDesk, I'm impressed so far. Elegant, powerful, lightweight.

Jan, many thanks to you too for the expertly written script. Very useful.

On another note, I have an invalid bib file that consistently crashes BibDesk. Are the devs interested in squashing the bug? I think what caused the crash was having a large number of semicolon-delimited attachment paths within a single Local-URL field.


------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Bibdesk-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bibdesk-users