[OS X TeX] Scripting help

"M. Tamer Özsu" via MacOSX-TeX macosx-tex at email.esm.psu.edu
Fri Jul 21 20:04:53 CEST 2023


Some of the bibtex entries I download has entries in them that I don't want to keep, e.g., Month. I thought I would write a script that takes the Field Name and a Value and sets that field to that value. I came up with the following but it is throwing an error -- it reads the field name and the value but then gives an error: "AppleScript reported the following error: (null)". I suspect it is a simple fix, but I don't know scripting well enough. I would appreciate any suggestions.

tell application "BibDesk"
	activate
	
	-- without document, there is no selection, so nothing to do
	if (count of documents) = 0 then
		beep
		display dialog "No documents found." buttons {"•"} default button 1 giving up after 3
	end if
	set thePublications to the selection of document 1
	
	set theField to text returned of (display dialog "Enter field to set:" default answer "")
	set theValue to text returned of (display dialog "Enter value to set:" default answer "")
	
	if (theField is not "") then
		repeat with thePub in thePublications
			set theField of thePub to theValue
		end repeat
	end if
	
	set selection of document 1 to thePublications
	
end tell -- Bibdesk


==Tamer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/macostex-archives/attachments/20230721/489fcafd/attachment.htm>
-------------- next part --------------
----------- Please Consult the Following Before Posting -----------
TeX FAQ: https://www.tug.org/mactex/faq/index.html
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/TeX/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: https://www.tug.org/mactex/index.html
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex


More information about the macostex-archives mailing list.