Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Christiaan Hofman <cmhofman@gm...> - 2009-07-27 16:11:56
|
On Jul 27, 2009, at 5:19 PM, Andreas Fischlin wrote: > Dear all, > > Perhaps someone can help me: I'm trying to export merely the > currently selected publications to a xml file from BibDesk (Version > 1.3.21 (1525)). I can happily save all publications in the current > document with an applescript similar to this: > > set theOutPFN to ((path to home folder) & "refs.xml" as string) > tell application "BibDesk" > set theBibDeskDocu to first document > save theBibDeskDocu in file theOutPFN as "EndNote XML" > display dialog "Saved" buttons {"OK"} default button {"OK"} > end tell > > however, a script using the export command similar to the following, > what I actually want, does not work > > set theOutPFN to ((path to home folder) & "refs.xml" as string) > tell application "BibDesk" > set theBibDeskDocu to first document > set thePubs to selection of theBibDeskDocu > export theBibDeskDocu to file theOutPFN using template "EndNote > XML" for (list thePubs) > display dialog "Saved" buttons {"OK"} default button {"OK"} > end tell > > and fails with error message: Error -1728: BibDesk got an error: > Can't get file "<path>:refs.xml". This seems to me to be a bug in > BibDesk, since above syntax is accepted by the script editor and > follows BibDesk's AppleScript dictionary description of the export > command. > First problem: You can't write 'file aPath' in a script. The "file" type in AppleScript is very buggy. It generally should be considered read-only. When you want to create a file object you should use either "POSIX file" or "file specification", I always use the former. This is not a BibDesk bug, it's an AppleScript bug (it does not work in any app). And whether SE can /compile/ a script does not mean it can /execute/ a command, because compiling does not check the implementation of the various apps and extensions. Second problem: Did you define a template named "EndNote XML" the Template prefs? Because there does not exist one by default. Third problems: "list thePubs" is not a valid reference, just evaluate thePubs or use "get" to get them if it does not work directly. > There might be an alternative approach by using a custom template > > <?xml version=\"1.0\" encoding=\"UTF-8\"? > > <xml> > <records> > <$publications><$endNoteString/></$publications> > </records> > </xml> > > and then using the first AppleScript > > save theBibDeskDocu in file theOutPFN as "My EndNote XML" > > Having installed in the "Template" preference of BibDesk above > template as the main page under "My EndNote XML" for xml files. > Above template works fine, but again, it exports all records. AFAIK > I would need a "Collection modifier key" to export only the > selection. Yet, BibDesk's help on this topic does no list any. Does > anyone know whether it is possible to specify via above template > such that only currently selected publications are exported? An if > this is possible, does anyone know how the syntax of such a > modification of this template would look like? > The save command always saves the whole document. That's what it is supposed to do. The "save" command is a standard command. Though it may be possible to change the template to only export the selection, it would be the wrong thing to do. > Thanks for your help and cooperation. > > Sincerely yours, > Andreas Fischlin > You should just use the "export" command, passing the template you wrote above. You can pass the template either as an explicit string ('using text'), by file reference, or (when you've registered it) by name. Christiaan > -- > ________________________________________________________________________ > ETH Zurich > Prof. Dr. Andreas Fischlin > Systems Ecology - Institute of Integrative Biology > CHN E 21.1 > Universitaetstrasse 16 > 8092 Zurich > SWITZERLAND > andreas.fischlin@... > http://www.sysecol.ethz.ch/staff/af > > +41 44 633-6090 phone > +41 44 633-1136 fax > |