On Aug 2, 2011, at 17:11, Miguel Ortiz Lombardía wrote:

> 
> I have written a "proof of concept" script that works for me. It is far
> from being elegant since it involves two lists (the keys in Applescript
> records have to follow the requirement of variable names, precluding
> also the use of spaces) that must be populated and, importantly, must
> have the equivalent values in the same list index. In case anyone is
> interested and have improvement ideas I have posted it here:
> 
> http://www.ysbl.york.ac.uk/~mol/translatejnames.zip
> 
> Any ideas are welcome.
> 
> 
> -- 
> Miguel

You could better also compare the bibtex string, because the value can return 
the expanded value of a macro. Note that in that case the string value is 
enclosed in braces. And don't return 0 as default index, because than you will 
use the first item as default, which is not what you want. Perhaps better to 
have a list of lists for your input like {{"J Mol Biol", "jmb"},{"J Biol Chem", 
"jbc"}} then

on getMacroForBibTeXName(theList, theName)
        repeat with anItem in theList
                if ("{" & item 1 of theItem & "}") is theName then return item 
2 of theItem
        end repeat
        return missing value
end getMacroForName

After that you can use something like this:

set theMacro to getMacroForBibTeXName(theJournals, its BibTeX string)
if theMacro is not missing value then set its BibTeX string to theMacro

Christiaan


------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
Bibdesk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-users

Reply via email to