Applescript: get attachment path?

Users asking other users for AppleScripts that work with Bookends.
Post Reply
iandol
Posts: 465
Joined: Fri Jan 25, 2008 2:31 pm

Applescript: get attachment path?

Post by iandol »

Hi Jon, it would be neat if we could get get the attachment path using applescript, i.e. a new event: «event ToySGETA» uniqueID would return the path[s] of any attachments ref:uniqueID had.
Jon
Site Admin
Posts: 10048
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Applescript: get attachment path?

Post by Jon »

You can do that now. Create a format that outputs either attachment names (h) or file path to attachments (m). Then ask Bookends to return that reference using that format.

Jon
Sonny Software
iandol
Posts: 465
Joined: Fri Jan 25, 2008 2:31 pm

Re: Applescript: get attachment path?

Post by iandol »

Yes for me that would be fine, I suppose it would be good to be able to write a script others could use without requiring them to also install a new format? This was actually inspired by the OPML script Dave83 wrote, I wanted to add links to the PDF if present and make it so others could use it.
Jon
Site Admin
Posts: 10048
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Applescript: get attachment path?

Post by Jon »

The documentation is behind the times -- you can fetch the field "attachments" now and get the names, if that's useful.

To get the full path name without a format will, as you say, require a new AppleEvent.

Jon
Sonny Software
iandol
Posts: 465
Joined: Fri Jan 25, 2008 2:31 pm

Re: Applescript: get attachment path?

Post by iandol »

OK will give that a go, at least having the names means we can say what, and how many, the attachments are, even if we may not easily get their path. Again, this isn't major, but something to consider for a wishlist for future additions to Bookends very useful applescript support.

While we're on the subject of a wishlist for new applescript events, just in case you missed this post, it would be really nice to be able to create static groups with a set of uniqueIDs.
iandol
Posts: 465
Joined: Fri Jan 25, 2008 2:31 pm

Re: Applescript: get attachment path?

Post by iandol »

Jon wrote:you can fetch the field "attachments" now and get the names,

Code: Select all

set ref_att to «event ToySRFLD» ref_id given string:"attachments"
Hi Jon, I tried this and get the title, not the name of the attachment?
Jon
Site Admin
Posts: 10048
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Applescript: get attachment path?

Post by Jon »

No, I hadn't see that post. And I'll check out the attachments issue.

Jon
Sonny Software
Jon
Site Admin
Posts: 10048
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Applescript: get attachment path?

Post by Jon »

An oversight on my part. It will work in the next update.

Jon
Sonny Software
Jon
Site Admin
Posts: 10048
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Applescript: get attachment path?

Post by Jon »

iandol wrote:While we're on the subject of a wishlist for new applescript events, just in case you missed this post, it would be really nice to be able to create static groups with a set of uniqueIDs.
Do you know that when you scan a document all of the citations used are in the Hits list (in the order they were found)? So instead of a script, just

1. Scan
2. Make a new group and have the popup menu in the naming dialog set to Add Hits

Jon
Sonny Software
iandol
Posts: 465
Joined: Fri Jan 25, 2008 2:31 pm

Re: Applescript: get attachment path?

Post by iandol »

Yes, thank you. But as much as I miss the Bookends Format editor (by far best in class!!!), I've switched over my workflow to using Pandoc for all my manuscripts. Pandoc uses citeproc and CSL files to automagically create bibliographies. This means when I output my work from Scrivener, it handles generating the bibliography, plus the many things that Pandoc does (handling LaTeX maths, proper outlining, multiple format support, proper figure markup, cross-referencing, very flexible document level filtering). So from the same raw Scrivener manuscript I can flexibly make a fully formatted Word / LaTeX / ODT document without any extra fussing.

I also have to work with some manuscripts where my Windows collaborators use Endnote. I've made a filter to convert Endnote temp citations to BibTeX keys on the fly (so the source document always remains endnote, but I can still generate a bibliography from my Bookends database via Pandoc, no need to use Endnote! 8) ).

The only downside to my workflow is having to tweak CSL if I want a customised bibliography format, and not being able to have groups of my manuscript refs in Bookends. Hence the wish to be able to create groups programmatically.
Jon
Site Admin
Posts: 10048
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Applescript: get attachment path?

Post by Jon »

I'll see what I can do.

Jon
Sonny Software
Post Reply