[Return] key in a field of multiple values (AppleScript)
Posted: Fri Apr 01, 2016 1:41 am
The following AppleScript is taken from Tinderbox Forum.
The purpose is to push a number of fields including the "Author", "ID", "Abstract" ect to Tinderbox spreadsheet. The script works perfectly except one problem. When the Authors are two and more, the Return key between the Author names breaks the spreadsheet.
Here is the screen shot of two references: first with a single author;

As you can see, all the fields are correctly populated in the above spreadsheet (attribute-value matrix). Now look at with 3 authors:

Now, the fields below the "Authors" field are not populated; and each of the rest of the authors have their own row (note). Is there a way to make the Return key not to cause a break? I mean, in a way, the return key could be neutralized into a single field? or a way to modify the scrip to avoid the break down?
Code: Select all
--sends name, id, url, notes of selected Bookends references to clipboard for pasting into Tinderbox
--other Bookends fields accessible: authors, editors, journal, volume, pages, thedate, publisher, location, title2, abstract, user1...user20
tell application "Bookends"
set selected_ids to «event ToySRUID» "Selection" --gets ids (line-feed-delimited strings)
set selected_ids to words of selected_ids --coerces to list
--"header" row -- these map to (or become new) Tinderbox attribute names:
set tsv_string to "Name" & tab & "Authors" & tab & "BE_ID" & tab & "URL" & tab & "Text" & return
repeat with i from 1 to length of selected_ids
set an_id to item i of selected_ids
set be_title to «event ToySRFLD» an_id given string:"title"
set be_author to «event ToySRFLD» an_id given string:"authors"
set be_uri to "bookends://sonnysoftware.com/" & an_id
set be_notes to «event ToySRFLD» an_id given string:"abstract"
--data row: order/number of columns must match header row above
set tsv_string to tsv_string & be_title & tab & be_author & tab & an_id & tab & be_uri & tab & quote & be_notes & quote & return
end repeat
set the clipboard to tsv_string
end tell
Here is the screen shot of two references: first with a single author;

As you can see, all the fields are correctly populated in the above spreadsheet (attribute-value matrix). Now look at with 3 authors:

Now, the fields below the "Authors" field are not populated; and each of the rest of the authors have their own row (note). Is there a way to make the Return key not to cause a break? I mean, in a way, the return key could be neutralized into a single field? or a way to modify the scrip to avoid the break down?