Hook `Copy Link` name format for Bookends references

A place for users to ask each other questions, make suggestions, and discuss Bookends.
Post Reply
LucCogZest
Posts: 13
Joined: Thu Oct 01, 2020 12:35 pm
Contact:

Hook `Copy Link` name format for Bookends references

Post by LucCogZest »

Hi there, I'm a co-founder of CogSci Apps that makes the Hook productivity Mac app, and recent convert to Bookends. (I'm also an adjunct professor of Cognitive Science and of Education at Simon Fraser University.)

First a bit of context: The Hook app (amongst other things) enables users to copy a link to the open or selected item of most apps (in various formats: RTF, HTML, Markdown, other plain text), and to hook (bidirectionally link) items together. It provides a uniform command across apps so you don't have to go looking for `Copy Link`, which is often missing. So you can use Hook's `Copy Link` on a file, an email, a web page, a task (e.g., in OmniFocus or Things), etc.

Thanks to Bookend's AppleScript dictionary, Hook is compatible with Bookends. So you can copy formatted Bookend links and hook them to anything.

Now the point of this post

Hook's Bookends `Get Name` script currently sets the name of the link to the title of the selected item. However, we've had ]a request on our forum (https://discourse.hookproductivity.com/ ... tion/1676/) for the default to be the full reference. I'm not very familiar yet with the Bookends dictionary but I proposed some AppleScript for that there which seems to work, i.e.,

Code: Select all

tell application id "com.sonnysoftware.bookends"
	
	set selected_ids to «event ToySRUID» "Selection"
	set selected_ids to words of selected_ids --coerces to list
	set n to count of selected_ids
	if n ≥ 1 then
		set sid to item 1 of selected_ids
		return «event ToySGUID» («event ToySRUID» "Selection") given «class RRTF»:"false", string:"APA 6th Edition"
	end if
	
end tell
The Get Name script determines the name that is returned by `Copy Link` and `Copy Markdown Link`. (There's also a `Get Address`

Some people might prefer `Get Name`to default to the citation format instead of the full reference, and I assume there's something in the Bookends AppleScript dictionary for there.

We're open to changing the default format, so we'll listen to what people suggest. And Hook is very configurable, so use whatever Bookends AppleScript support. (You can also change the format of the URL returned using Hook's Bookends' `Get Address` script. For instance, you could configure it to return a hook://file URL instead of bookends:// URL, which would make it easier to open the link to the PDF in another app, like Skim or PDFPenPro for example. But that should probably be discussed in separate topic.)

I've started this topic here and will include a link to it from [the Hook forum topic]((https://discourse.hookproductivity.com/ ... tion/1676/) so that Hook users know where to look for this side of the discussion. And I hope it is of use to Bookends users as well. Given that I run the Hook productivity 'show' and have moved to Bookends, Bookends integration will get special attention ;) .
Co-founder, CogSci Apps https://CogSciApps.com
Adjunct Professor SFU
Papers: http://sfu.ca/~lpb
Books: https://cogzest.com/books
Blog: https://CogZest.com
Hookmark app (Previously known as "Hook"): https://hookproductivity.com
msteffens
Posts: 37
Joined: Thu Jul 19, 2007 10:04 am
Location: Germany
Contact:

Re: Hook `Copy Link` name format for Bookends references

Post by msteffens »

This script should work similar to yours but uses the newer script implementation:

Code: Select all

tell application id "com.sonnysoftware.bookends"
	tell front library window
		
		set selectedPubs to selected publication items -- requires Bookends ≥ 13.2.1
		
		if selectedPubs is not {} then
			set aPub to first item of selectedPubs
			
			-- NOTE: leave out the "using ..." part to instead format according to your
			--       current Bookends setting (see the “Biblio > Default Format” menu)
			set formattedReference to format aPub using "APA 6th Edition.fmt"
			
			return formattedReference
		end if
		
	end tell
end tell
LucCogZest
Posts: 13
Joined: Thu Oct 01, 2020 12:35 pm
Contact:

Re: Hook `Copy Link` name format for Bookends references

Post by LucCogZest »

Thank you!
Co-founder, CogSci Apps https://CogSciApps.com
Adjunct Professor SFU
Papers: http://sfu.ca/~lpb
Books: https://cogzest.com/books
Blog: https://CogZest.com
Hookmark app (Previously known as "Hook"): https://hookproductivity.com
rkaplan
Posts: 3
Joined: Tue Sep 29, 2020 11:58 am

Re: Hook `Copy Link` name format for Bookends references

Post by rkaplan »

Hi

If the script is selected with a Group selected, the item returned is the first citation in the Group.

Is it possible to have the script instead return a link to the Group?
Post Reply