On Feb 9, 2010, at 17:57, Fischlin Andreas wrote:

> On 09/Feb/2010, at 17:09 , Christiaan Hofman wrote:
> 
>> 
>> tell document 1 of application "BibDesk"
>> set theKeys to {}
>> set theDuplicateKeys to {}
>> set theDuplicates to {}
>> repeat with thePub in publications
>>   set theKey to cite key of thePub
>>   ignoring case
>>     if (theKeys contains theKey and theDuplicateKeys does not  
>> contain theKey) then
>>       set theDuplicates to theDuplicates & (get publications whose  
>> cite key is theKey)
>>       set end of theDuplicateKeys to theKey
>>     end if
>>     set end of theKeys to theKey
>>   end ignoring
>> end repeat
>> set selection to theDuplicates
>> end tell
>> 
>> Christiaan
> 
> Thanks. In the meantime I came up with the following "recyling" some  
> of your previous inputs. Any idea which one would be more efficient?
> 

Yours is probably a bit more efficient, as it leaves the slower part to Cocoa. 
It's also essentially what we're doing in code.

Christiaan

>                       tell first document of application "BibDesk"
>                               set thePubs to (sort (get publications) by 
> "Cite Key" subsort by  
> "Date-Added" without ascending)
>                               set theDupes to {}
>                               set prevCiteKey to missing value
>                               set prevPub to missing value
>                               repeat with aPub in thePubs
>                                       set aCiteKey to cite key of aPub
>                                       if aCiteKey is prevCiteKey then
>                                               if (not (prevPub is missing 
> value)) and (theDupes does not  
> contain {prevPub}) then
>                                                       set end of theDupes to 
> prevPub
>                                               end if
>                                               set end of theDupes to aPub
>                                       end if
>                                       set prevCiteKey to aCiteKey
>                                       set prevPub to aPub
>                               end repeat
>                       end tell
>                       set selection to theDupes
> 
> Andreas
> 
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Bibdesk-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bibdesk-users


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Bibdesk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-users

Reply via email to