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

On 29 Jun 2007, at 2:36 PM, Derick Fay wrote:

You can use this applescript to add keywords without opening the individual publication records. Select the publication(s) to which you want to add a keyword, then run the script. You can add as many keywords as you want; just separate them with commas. I've also posted a copy here: http://dfay.fastmail.fm/bibdesk/

Although the script tries to check for an empty keywords field, it doesn't detect it for reasons unknown to me, so if the keywords field is empty when the script is run, the script will add ", " at the beginning of the keywords. This is immaterial, just messy, but if someone can tell me how to check the keywords successfully, I'd appreciate it.

I have this in a command in OnMyCommand, set to be visible only in BibDesk.

Derick
- - - - -

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
                if ((keywords of thePub) is not "") then
                        set delimiter to ", "
                else
                        set delimiter to ""
                end if
                set keywords of thePub to (keywords of thePub & ", " & 
theKeyword)
        end repeat
        
        set selection of document 1 to thePublications
        
end tell -- Bibdesk

- - - - -


On Jun 29, 2007, at 4:57 AM, Niels Kobschätzki wrote:

On Jun 29, 2007, at 10:48 AM, Christiaan Hofman wrote:


On 29 Jun 2007, at 9:03 AM, Niels Kobschätzki wrote:

Hi!

I want to add keywords to several publications but do not want to
open each time the publication just for adding keywords.
There is now the preview-pane and it would be more or less optimal to click there on the keywords-field for adding them there. Is there any
way to do it?
Or is there any other way to add keywords w/out opening each
publication first?

Niels



<snip editing in preview pane is not possible>

What you can do is use the field group: choose Keywords as the
grouping field on the left, and drag your publications to the keyword
you want to set. If the keyword does not yet exist, use Database >
New Field Group With Selection.

Then it's faster to open the publication for adding those two, three
keywords I want to add to each publication (which differ)

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

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




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

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