On Aug 14, 2011, at 19:19, Markus Guhe wrote:

> Dear BibDesk developers,
> 
> First of all, apologies for sending this directly to the developers' mailing 
> list, but it seemed the least inappropriate thing to do ...
> 
> I have a question about the performance of BibDesk AppleScripts in Lion. The 
> script below worked like a charm in OS X versions up to 10.6, but performance 
> got noticeably worse in 10.7. Admittedly, the script is a bit twisted -- it 
> looks for the record that contains a link to a particular file path and 
> returns the values of some fields of that record --, but performance has 
> never been an issue. I'm just wondering whether perhaps you came across 
> anything similar?
> 
> If you like some context: I am using this script in my SlipBox application to 
> retrieve information from a BibTeX record when a user wants to import 
> annotations of a PDF that he/she made with Skim.
> 
> Thanks,
> Markus
> 
> tell application "BibDesk"
>       set theDoc to document 1
>       tell theDoc
>               set pubList to publications
>               set thePath to "/Users/blah/Desktop/ABC.pdf"
>               repeat with thePub in pubList
>                       tell thePub
>                               set theFiles to get linked files
>                               repeat with theFile in theFiles
>                                       set theURL to URL of linked file 1
>                                       if theURL is thePath then
>                                               set theCiteKey to the cite key 
> of thePub
>                                               set thePages to value of field 
> "Pages"
>                                               set theKeywords to value of 
> field "Keywords"
>                                               return {theCiteKey, thePages, 
> theKeywords}
>                                       end if
>                               end repeat
>                       end tell
>               end repeat
>               return {pubList}
>       end tell
> end tell
> 
> -- 
> Markus Guhe
> [email protected]
> http://tabi-software.com/
> 

I can't say anything about performance on Lion, as I don't have Lion myself.

I also see nothing in the script that looks like it could be a bottleneck.

But of course AppleScript support is 100% unpredictable and 100% unreliable, it 
never works exactly as it should work and never works or doesn't work the same 
way across OS versions.

Apart from this, I am not sure what this script is supposed to do, but I am 
sure it does not do what you want it to do, because the main part does exactly 
nothing. Also, what it returns is completely inconsistent, when it finds 
nothing it returns a list of a list of pubs, otherwise it returns a list of 
some field values. Huh? The main point though is that the "if" block always 
will NOT be executed, because a URL is never equal to a path. Perhaps you want 
to check something like 'if (POSIX path of linked files contains thePath)'?

Christiaan


------------------------------------------------------------------------------
FREE DOWNLOAD - uberSVN with Social Coding for Subversion.
Subversion made easy with a complete admin console. Easy 
to use, easy to manage, easy to install, easy to extend. 
Get a Free download of the new open ALM Subversion platform now.
http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Bibdesk-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-develop

Reply via email to