Le 02/08/2011 19:31, Christiaan Hofman a écrit :
> 
> 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. 

Good point, I hadn't thought about that possibility.

> 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.

I thought that in Applescript the index of the first element was 1
(contrary to python being 0) and that 0 would then be safe (but I should
have added a test) However, nevermind because :

> 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
> 

this is far more elegant a solution! ( it was my idea of keeping two
lists that I didn't like )

Now, my concern is about speed if the list becomes a long one... I will see.

Thank you again for your valuable help!


-- 
Miguel

Architecture et Fonction des Macromolécules Biologiques (UMR6098)
CNRS, Universités d'Aix-Marseille I & II
Case 932, 163 Avenue de Luminy, 13288 Marseille cedex 9, France
Tel: +33(0) 491 82 55 93
Fax: +33(0) 491 26 67 20
mailto:[email protected]
http://www.afmb.univ-mrs.fr/Miguel-Ortiz-Lombardia

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


------------------------------------------------------------------------------
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