I have an script which works in Applescript but when I use the same code in an ASOC script it does not. Any amended record is added to the middle of another existing record and does not replace the intended record. I have tried every combination of text items/paragraphs etc but nothing works so a solution wold be very gratefully received.
set theNumber to memberNumber’s stringValue() as text – Coerce Cocoa text to Applescript text
set theFamily to memberFamily’s stringValue() as text
set theTitle to memberTitle’s stringValue() as text
set theInitials to memberInitials’s stringValue() as text
set theSurname to memberSurname’s stringValue() as text
set theAddress1 to memberAddress1’s stringValue() as text
set theAddress2 to memberAddress2’s stringValue() as text
set theAddress3 to memberAddress3’s stringValue() as text
set theAddress4 to memberAddress4’s stringValue() as text
set amendedRecord to theNumber & "," & ¬
theFamily & "," & ¬
theTitle & "," & ¬
theInitials & "," & ¬
theSurname & "," & ¬
theAddress1 & "," & ¬
theAddress2 & "," & ¬
theAddress3 & "," & ¬
theAddress4
--
set fileReference to read "/Users/Ours/Documents/Cats Protection/Membership/CP Members copy.csv" as «class utf8»
set text item delimiters to return
set recordList to text items of fileReference
set item theSel of recordList to amendedRecord
set fileReference to open for access "/Users/Ours/Documents/Cats Protection/Membership/CP Members copy.csv" with write permission
set eof fileReference to 0
write (recordList as text) to fileReference as «class utf8»
close access fileReference