# Hookmark Script for Zotero
## Metadata
**Status**:: #x
**Zettel**:: #zettel/permanent
**Created**:: [[2022-10-05]]
**Topic**:: [[♯ Hookmark]]
**Parent**:: [[♯ Zotero]]
## Get Address
This script depends on [[Zotero Better BibTex|Better BibTex]] instead of zotxt.
It requires [[Personal Better BibTex Settings#Postscript|adding the item-key field to the CSLJson export]].
```applescript
use scripting additions
use framework "Foundation"
set response to do shell script "curl -s -G http://127.0.0.1:23119/better-bibtex/cayw\\?selected=1\\&format=translate\\&translator=csljson"
if response is equal to "" then error "no selected items" number -10000
set str to current application's NSString's stringWithString:response
set theData to str's dataUsingEncoding:(current application's NSUTF8StringEncoding)
set {res, theErr} to current application's NSJSONSerialization's JSONObjectWithData:theData options:0 |error|:(reference)
if res is missing value then error (theErr's localizedDescription() as text) number -10000
set aList to res as list
set theName to title of item 1 of aList
set theKey to |item-key| of item 1 of aList
set theAuthors to author of item 1 of aList
set theFirstAuthor to item 1 of theAuthors
set theAuthor to literal of (theFirstAuthor & {literal:""})
if theAuthor is equal to "" then
set theAuthor to (|given| of theFirstAuthor) & " " & (family of theFirstAuthor)
end if
if the length of theAuthors > 0 then
set theAuthor to theAuthor & " et al."
end if
set theLink to "[" & theAuthor & " - " & theName & "](zotero://select/items/" & theKey & ")"
return theLink
```