Ok....there was an embarrassingly sloppy mistake but it's fixed now. That's what I get for scripting before coffee :) .

Working version, which doesn't add the extra comma & space, is at http://dfay.fastmail.fm/bibdesk/ and pasted below:

tell application "BibDesk"
        activate
        
        -- without document, there is no selection, so nothing to do
        if (count of documents) = 0 then
                beep
display dialog "No documents found." buttons {"•"} default button 1 giving up after 3
        end if
        set thePublications to the selection of document 1
        
set theKeyword to text returned of (display dialog "Enter keyword to add:" default answer "")
        
        repeat with thePub in thePublications
                set currentKeywords to get keywords of thePub as string
                if (currentKeywords is not "") then
                        set delimiter to ", "
                else
                        set delimiter to ""
                end if
set keywords of thePub to (keywords of thePub & delimiter & theKeyword)
        end repeat
        
        set selection of document 1 to thePublications
        
end tell -- Bibdesk



On Jun 29, 2007, at 8:50 AM, Christiaan Hofman wrote:

Try adding things like "get" in various places (like "get keywords of thePub"). Or separate getting the keywords and comparing it to "" into two statements. Or add a line "set thePub to contents of thePub" after the repeat line (that is usually a good thing to do with a "repeat with" statement, annoying but that's what AppleScript is).

BTW, an alternative is also to use the Database Find & Replace panel.

Christiaan

=============================================
Derick A. Fay, Ph.D.
Visiting Assistant Professor
Department of Anthropology
Union College
Schenectady, NY 12308




-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bibdesk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-users

Reply via email to