On Jul 31, 2012, at 21:48, Charles Turner wrote: > OK, I give up. Always hated file handling in Applescript. In the > below, does anyone know the correct incantation for "removing" a > linked file from a publication? > > tell application "BibDesk" > set thePub to publication 27 of document "Primary.bib" > set theLinkedFiles to every linked file of thePub -- Need to work > with the original references > repeat with theFile in theLinkedFiles > set theUSBPath to POSIX path of theFile > set theLocalPath to "/Volumes/foo" & text 14 thru -1 of > theUSBPath as string > add linked file theLocalPath as POSIX file to thePub > remove (a reference to theFile) from thePub -- <- Applescript > not > happy with this > end repeat > end tell > > I've tried every conceivable incantation, but no luck. I'm sure this > is my trouble with Applescript, and has nothing to do with Bibdesk. > :-) > > Thanks, Charles
You should remove the linked file as a reference. Once you evaluate it (and AppleScript almost always does this automatically), it's just the file object (i.e. the URL), which is not the linked file object (i.e. a reference from the pub to a linked object). What you can do best is to run over the *indexes* of the linked files rather than the linked files themselves. Also be aware that when you add/remove linked files, the reference to the others may change. Christiaan ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Bibdesk-users mailing list Bibdesk-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-users