Dear Christiaan, There is something odd going on. The same code snippet does sometimes work, sometimes not. I do at the moment not understand why. The variant I have previously reported on worked for me for a while, but after a restart of BibDesk, it did that no more. Your variant never worked on my system. Restarting the system seems not to make any difference. Initially neither the code by Christiaan nor my variant work. Only after having opened the crashing script in AppleSript Editor, saving it once more, does the script work.
If there is no current selection the AppleScript hangs for a very long time when executing a statement such as set theGroupsSelected to (group selection of first document) If I try to stop the script by clicking on the Stop button in AppleScript Editor, after a long while the script ends with "error "User canceled." number -128". Any idea what might be going on? A bug in BD's AppleScripting? I tried a more "defensively" written variant: tell application "BibDesk" set theGroupsSelected to (group selection of first document) set theNoOfGroups to (count of theGroupsSelected) if theNoOfGroups > 0 then set firstGroup to first item of theGroupsSelected external of firstGroup end if end tell It fails with error "BibDesk got an error: Can’t get library group id \"4071B7B3-0C8E-4C7F-91CA-7979B9ED79F2\" of document \"Some Refs.bib\"." number -1728 from library group id "4071B7B3-0C8E-4C7F-91CA-7979B9ED79F2" of document "Some Refs.bib" at the execution of the external statement. Once I encountered this error a few times. Suddenly the very same script succeeds and correctly reports the external status of the current selection. Could there be some not properly inited internal variables? Should I file a bug report? I am using latest nightly build of BibDesk, i.e. Version 1.5.1 (1816). Regards, Andreas On 09/Apr/2010, at 14:45 , Fischlin Andreas wrote: Christiaan, Thanks. However, for the record, your code snippet throws an error: error "BibDesk got an error: Can’t get group selection." number -1728 from group selection However tell application "BibDesk" external of (get first item of (get group selection of first document)) end tell works. Regards, Andreas ETH Zurich Prof. Dr. Andreas Fischlin Systems Ecology - Institute of Integrative Biology CHN E 21.1 Universitaetstrasse 16 8092 Zurich SWITZERLAND [email protected]<mailto:[email protected]> www.sysecol.ethz.ch<http://www.sysecol.ethz.ch> +41 44 633-6090 phone +41 44 633-1136 fax +41 79 221-4657 mobile Make it as simple as possible, but distrust it! ________________________________________________________________________ On 09/Apr/2010, at 13:39 , Christiaan Hofman wrote: tell application "BibDesk" external of (get first item of group selection) end tell Christiaan On Apr 9, 2010, at 13:29, Fischlin Andreas wrote: Hi all, What is the best way to determine in an AppleScript that current selection is with external publications? I guess something similar to this tell application "BibDesk" set theBibDeskDocu to first document set thePubs to selection of theBibDeskDocu if thePubs is not {} then tell theBibDeskDocu tell first item of thePubs set theCiteKey to get cite key set selectionIsExternal to theCiteKey is "cite-key" end tell end tell end if end tell is not the proper method to determine the value of selectionIsExternal. Is there a better one? Thanks for your help and cooperation. Sincerely yours, Andreas Fischlin ETH Zurich Prof. Dr. Andreas Fischlin Systems Ecology - Institute of Integrative Biology CHN E 21.1 Universitaetstrasse 16 8092 Zurich SWITZERLAND [email protected]<mailto:[email protected]> www.sysecol.ethz.ch<http://www.sysecol.ethz.ch> +41 44 633-6090 phone +41 44 633-1136 fax +41 79 221-4657 mobile Make it as simple as possible, but distrust it! ________________________________________________________________________ ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Bibdesk-users mailing list [email protected]<mailto:[email protected]> https://lists.sourceforge.net/lists/listinfo/bibdesk-users ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Bibdesk-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/bibdesk-users ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Bibdesk-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/bibdesk-users ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Bibdesk-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/bibdesk-users
