[OS X TeX] Applescript for BibDesk

Claus Gerhardt claus.gerhardt at urz.uni-heidelberg.de
Tue Sep 21 18:29:27 CEST 2004


Below is an Applescript for BibDesk which cuts the content of any field 
where the cursor is, say the content is  "hep-th/9803179", and replaces 
it with

\href{http://arXiv.org/abs/hep-th/9803179}{hep-th/9803179}


The script could of course be easily modified to suit other needs.

Claus


-- Applescript for BibDesk
-- href
-- Claus Gerhardt, September 2004


on do_menu(app_name, menu_name, menu_item)
	try
		-- bring the target application to the front
		tell application app_name
			activate
		end tell
		tell application "System Events"
			tell process app_name
				tell menu bar 1
					tell menu bar item menu_name
						tell menu menu_name
							click menu item menu_item
						end tell
					end tell
				end tell
			end tell
		end tell
		return true
	on error error_message
		return false
	end try
end do_menu


do_menu("BibDesk", "Edit", "Select All")
do_menu("BibDesk", "Edit", "Cut")
set pasteName to "\\href{http://arXiv.org/abs/"
tell application "System Events"
	tell process "BibDesk"
		keystroke pasteName
	end tell
end tell
do_menu("BibDesk", "Edit", "Paste")
tell application "System Events"
	tell process "BibDesk"
		keystroke "}{"
	end tell
end tell
do_menu("BibDesk", "Edit", "Paste")
tell application "System Events"
	tell process "BibDesk"
		keystroke "}"
	end tell
end tell



--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the macostex-archives mailing list