[OS X TeX] Scripting help

Michael Sharpe msharpe at ucsd.edu
Sun Jul 23 12:04:26 EDT 2023


If you change the block

> if (theField is not "") then
> repeat with thePub in thePublications
> set theField of thePub to theValue
> end repeat
> end if
 
to 

 if (theField is not "") then
repeat with thePub in thePublications
tell thePub
set the value of field theField to theValue
end tell
end repeat
end if

then it seems to work.

Michael

> On Jul 21, 2023, at 11:04 AM, M. Tamer Özsu via MacOSX-TeX <macosx-tex at email.esm.psu.edu> wrote:
> 
> 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
> ----------- Please Consult the Following Before Posting -----------
> TeX FAQ: https://urldefense.com/v3/__https://www.tug.org/mactex/faq/index.html__;!!Mih3wA!H6La8uXqDrJtOBtyAUEkdnU4gLkiuApZRkVB8x4c9ZOqTRhvr-g1Jo2ZOFH043ts1646O9hvliywbo8RzfZtrzGolmM$ 
> List Reminders and Etiquette: https://urldefense.com/v3/__https://sites.esm.psu.edu/*gray/TeX/__;fg!!Mih3wA!H6La8uXqDrJtOBtyAUEkdnU4gLkiuApZRkVB8x4c9ZOqTRhvr-g1Jo2ZOFH043ts1646O9hvliywbo8RzfZtO3MP69w$ 
> List Archives: https://urldefense.com/v3/__http://dir.gmane.org/gmane.comp.tex.macosx__;!!Mih3wA!H6La8uXqDrJtOBtyAUEkdnU4gLkiuApZRkVB8x4c9ZOqTRhvr-g1Jo2ZOFH043ts1646O9hvliywbo8RzfZtagPz8bQ$ 
>                https://urldefense.com/v3/__https://email.esm.psu.edu/pipermail/macosx-tex/__;!!Mih3wA!H6La8uXqDrJtOBtyAUEkdnU4gLkiuApZRkVB8x4c9ZOqTRhvr-g1Jo2ZOFH043ts1646O9hvliywbo8RzfZthAg9KEk$ 
> TeX on Mac OS X Website: https://urldefense.com/v3/__https://www.tug.org/mactex/index.html__;!!Mih3wA!H6La8uXqDrJtOBtyAUEkdnU4gLkiuApZRkVB8x4c9ZOqTRhvr-g1Jo2ZOFH043ts1646O9hvliywbo8RzfZtZrGhyXQ$ 
> List Info: https://urldefense.com/v3/__https://email.esm.psu.edu/mailman/listinfo/macosx-tex__;!!Mih3wA!H6La8uXqDrJtOBtyAUEkdnU4gLkiuApZRkVB8x4c9ZOqTRhvr-g1Jo2ZOFH043ts1646O9hvliywbo8RzfZtnti9USM$ 



More information about the MacOSX-TeX mailing list