>> 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:
>> 
>> BibDesk fails to find some files even though the paths are clearly correct.
>> 
>> 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-users

Reply via email to