Hi all,

Heureka, problem solved! :-) :-) :-)

Thanks for all the help. Indeed Christiaan's hint to specify the file outside any tell block did the trick and I got it working exactly as I wanted. A small snippet (my script is much more elaborate) for anyone possibly struggling with the same difficulties I can now state firmly, it works:

set theOutPFN to POSIX file "/Volumes/HD/uaf/Data Bases/AFs Lit/refs.xml" -- done outside any tell block!!!!

tell application "BibDesk"
   set theBibDeskDocu to first document
   set thePubs to selection of theBibDeskDocu
   tell theBibDeskDocu
       export for thePubs using template "My EndNote XML" to theOutPFN
   end tell
end tell

However, one caveat remains: The template is a custom template I have named "My EndNote XML" specified as the main page using BibDesk's Template preference settings. Using merely the built in "EndNote XML" (don't know whether that is really of the same kind) fails (thanks for that hint as well, Christiaan).

Regards,
Andreas

P.S.: Thanks for the teaching Christiaan, greatly appreciated. Although I am an experienced programmer, strongly typed languages such as Modula-2 are my favorites (I'm teachnig at ETH Zurich, ;-) ), all probably the reason why AppleScript confuses me regularly (my experience concur's with Will's).





Christiaan Hofman wrote:
On Jul 28, 2009, at 10:00 PM, Maxwell, Adam R wrote:

On 07/28/09 12:40, "Andreas Fischlin" <[email protected]> wrote:

I believe I considered these things already, but to cut a long story even shorter ( ;-) ), can you write an AppleScript statement with BibDesk's command 'export' that works? I know of none, regardlesss of file specifications and
came to the conclusion the command is defunct (BibDesk bug?).

Thanks, should you know of one and send me one. One example would already make
me quite happy. ;-)
The automatic RSS export script on the wiki does this, doesn't it?

       tell theDoc
           export using template theTemplateName to theFile
       end tell


Yes, as I said, look at the sample scripts. The export command just works. There's no BibDesk bug, your conclusion is wrong. If it does not work for you, you're just doing it wrong.

Again, what you need to learn is how to create file references, and in that respect AppleScript (not BibDesk) is rather messy and buggy. So I advice you to first play around with file references first in some test scripts to see what works, how they work, and what does not work (no need to use BibDesk). You will find that this won't work:

        set theFile to file "disk:path:to:a:file"

while this works for an exisiting file:

        set theFile to alias "disk:path:to:file"

and these works for any file (need not exist), but only outside a tell block:

        set theFile to file specification "disk:path:to:a:file"
        set theFile to POSIX file "/path/to/a/file"

Again, my recommendation is the last form. If you want to use the last two forms inside a tell block you should prepend by the keyword "my". You can also get a file object using the "choose file" command.

Anyway: any of this has nothing to do with BibDesk, it's built-in AppleScript support.

Christiaan


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

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