[OS X TeX] autogenerated cite keys; BibDesk 1.3.20

Alessandro Languasco languasc at gmail.com
Fri Aug 21 09:24:40 EDT 2009

Dear Adam,

No problem at all. I wasn't aware of the existence of the Script Hooks  
since I really love BibDesk, I tried to write down a simple  
AppleScript Hook
to do the trick. So, thanks again for the suggestion.

I modified the Alex Montgomery's script attached in this discussion


to get the code at the bottom of this message.

I post the code here as an example; maybe this could help someone else.
I hope this "attachment" will be not a problem for the list since they  
are just few lines.



The code works starting from the custom cite keys format


to get, as final result, the format:

(last name of the first author)&(first character of the last name of  
the remaining authors (up to 9))&
publication year&progressive character

Put this script in ~/Library/Application Support/BibDesk/Scripts/
and the set the "Did Generate Cite Key" Script Hook preferences to
execute this script every time you let BibDesk generate your cite keys

using terms from application "BibDesk"
	on perform BibDesk action with publications thePubs for script hook  
		tell application "BibDesk"
			repeat with thePub in thePubs
				tell thePub
					set theCiteKey to cite key of thePub
					set thePrefix to texts 1 thru ((offset of "-" in theCiteKey) - 1)  
of theCiteKey
					set theSuffix to texts ((offset of "-" in theCiteKey) + 2) thru  
-1 of theCiteKey
					set theCiteKeyItems to thePrefix & theSuffix
					set newCiteKey to theCiteKeyItems as string
					set cite key of thePub to newCiteKey
				end tell
			end repeat
		end tell
	end perform BibDesk action with publications
end using terms from


On 20/ago/09, at 19:02, Maxwell, Adam R wrote:

> On 08/20/09 02:58, "Alessandro Languasco" <languasc at gmail.com> wrote:
>> Just a follow-up: I had no need to write an Applescript program since
>> the auto-generated keys method in JabRef allowed me to have them  
>> formatted
>> as I wrote.
> Glad you found something that works.  If you use BibDesk in future  
> and need
> to continue this format, a script hook that fires when you set the  
> citekey
> is the best way to adjust it.
>> PS. yeah, I do have good reasons to use such a format.
> I admit that possibility :).  However, in my experience, most people  
> have no
> technical reason for a particular citekey format or paper-filing  
> scheme.  My
> reply looks more rude than I intended...sorry about that!

More information about the MacOSX-TeX mailing list