Dear Christiaan,

Thanks for your attempt to help, greatly appreciated.
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).
Ok, indeed, AppleScript is terrible in this respect. But what type of file specification does the export command want? And save is happy with what I tried to do, so the generality of your statement is not always given either. BTW, I tried all forms, as file reference, as alias, as POSIX file, but none of these seems to work. But whatever, all is fine with me as long as I would know what to do, i.e. what does export want? A file reference of an open file? An alias to an open file? Then I would need to create it first or a POSIX file to a not yet existing file, which export then will open itself? Would you perhaps know?

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

Second problem: Did you define a template named "EndNote XML" the Template prefs? Because there does not exist one by default.
Yes, but I tried several variants, since BibDesk has AFAIK one file format called "EndNote XML" built in and offered for exporting via GUI. I tried that one as well, the one the "Save" commands is happy with. Mine is called "My EndNote XML". I tested the latter by giving it to the save command and it worked fine. Only export never works.

Third problems: "list thePubs" is not a valid reference, just evaluate thePubs or use "get" to get them if it does not work directly.
Ok. Thanks. But statements such as

set theOutFileID to open for access file theOutPFN with write permission
set eof theOutFileID to 0
tell application "BibDesk"
   set theBibDeskDocu to first document
   set thePubs to selection of theBibDeskDocu
export theBibDeskDocu to theOutFileID using template "My EndNote XML" for (get list thePubs)
end tell
close access theOutFileID

fails also miserably with error Can't get list {publications id "bdskidentifier://E99D..." of document "SomeRefs.bib"


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.
Why, if this is the only thing that might be possible or do you see a way how I could get the command export to do what I want?

Thanks for your help and cooperation.
Sincerely yours,
Andreas Fischlin

You should just use the "export" command, passing the template you wrote above.

Ok I go along that route. However, note, before writing this reply I already tried another dozen variants and got none to work either (see one example above). If you know of any single variant in which the export command works, I would be very happy to learn about. Thanks.
You can pass the template either as an explicit string ('using text'), by file reference, or (when you've registered it) by name.
I have registered it, thus I tried by file reference the following legal AppleScript statements

export theBibDeskDocu to theOutFileID using text "My EndNote XML" for (list thePubs) export theBibDeskDocu to theOutFileID using template "My EndNote XML" for (list thePubs) export theBibDeskDocu to file theOutFileID using text "My EndNote XML" for (list thePubs) export theBibDeskDocu to file theOutFileID using template "My EndNote XML" for (list thePubs)

but all fail, because the export command seems not to understand the file reference, since I get errors such as: BibDesk got an error: Cant make 53 into type file specifier or can't make 75 into type reference although I understand the first two to be exactly what you recommended.

Thus, I don't know how to accomplish this. BTW, I have tried about two dozens of formulations and none worked. It's a pity, since I expect this command to use really a lot. To open a new BibDesk document, then drag and drop just the publications I want to export, then export them all, then trow away that document seems to me to be really quite combersome, given there is command export (which seems not to work). If you know of any variant in which export works, I'm happy to start thinking differently. Thanks.

Regards,
Andreas


Christiaan

--
________________________________________________________________________
ETH Zurich
Prof. Dr. Andreas Fischlin
Systems Ecology - Institute of Integrative Biology
CHN E 21.1
Universitaetstrasse 16
8092 Zurich
SWITZERLAND

[email protected]
www.sysecol.ethz.ch/staff/af

+41 44 633-6090 phone
+41 44 633-1136 fax



------------------------------------------------------------------------

------------------------------------------------------------------------------
------------------------------------------------------------------------

_______________________________________________
Bibdesk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-users

--
________________________________________________________________________
ETH Zurich
Prof. Dr. Andreas Fischlin
Systems Ecology - Institute of Integrative Biology
CHN E 21.1
Universitaetstrasse 16
8092 Zurich
SWITZERLAND

[email protected]
www.sysecol.ethz.ch/staff/af

+41 44 633-6090 phone
+41 44 633-1136 fax

Make it as simple as possible, but distrust it!
________________________________________________________________________
* *

begin:vcard
fn:Andreas Fischlin
n:Fischlin;Andreas
org:ETH Zurich;Systems Ecology - Institute of Integrative Biology
adr:Universitaetstrasse 16;;CHN E 21.1;Zurich;;8092;SWITZERLAND
email;internet:[email protected]
title:Prof. Dr.
tel;work:+41 44 633-6090
tel;fax:+41 44 633-1136
tel;home:+41 44 492-4636
tel;cell:+41 79 221-4657
url:www.sysecol.ethz.ch/staff/af
version:2.1
end:vcard

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Bibdesk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-users

Reply via email to