[OS X TeX] Scripting help

"M. Tamer Özsu" ozsut at mac.com
Fri Jul 21 14:04:53 EDT 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://email.esm.psu.edu/pipermail/macosx-tex/attachments/20230721/489fcafd/attachment.htm>


More information about the MacOSX-TeX mailing list