Some Background: I've used Skim with BibDesk for a while now for reading and annotating scientific journal articles. Recently, I purchased an android tablet and would like to use it to read and annotate .pdfs as well. I use the reference library [Eratosthenes](https://play.google.com/store/apps/details?id=com.mm.eratos) with [ezPDF Reader](https://play.google.com/store/apps/details?id=udk.android.reader) and sync all files through Dropbox. The issue I'm having is that Skim stores annotations as extended attribute files by default, which are not accessible to other devices through Dropbox. I've worked around this problem by saving the annotations as .fdf files and then linking the .fdf files to the citation entry in BibDesk. ezPDF reader can import .fdf files as annotations, and if the annotation file is linked to the BibDesk entry, both the .pdf and .fdf can be easily downloaded to the tablet without needing to sync the entire Dropbox folder full of hundreds of references.

I'd like to write an applescript that does this automatically, but am very new to applescript and am having a hard time getting started. I've written the following script to be executed when "command-s" is pressed while in skim:

```
tell application "Skim"
    set docPath to path of front document
    set notesPath to text 1 thru -5 of docPath & ".fdf"
    save front document
    save front document in notesPath as "Notes as FDF"
end tell

```

This essentially saves the current document while simultaneously exporting an .fdf file. Within the same script, I would like to link the .fdf file to the appropriate citation entry in BibDesk. This would involve:

* determining the citation entry name associated with the .pdf (maybe search through entries to locate one linked with the front document)
* check to see if the .fdf file is already linked to it
* if not, attach .fdf file

I haven't been able to find someone who's done something similar, and really can't get past the first step. I tried writing something basic (assume citation entry is highlighted, assume .fdf file is not linked), which produces no results:

```
tell application "BibDesk"
   set thePub to selection
   tell thePub
        set theFieldName to "Local-URL-2"
    set value of field theFieldName to fdfPath
   end tell
end tell

```

Is anyone familiar with Bibdesk applescripts able to help me with the second part of this code?

Thank you very much in advance.