Update Solution Found See Bottom of post if interested Seems simple enough and for the majority of the list it works, but at some point it messes up royally. The data for the list is coming from an asset in InDesign, but that is my end result and can be substituted for the sake of testing for a list defined within AS.
tell application "Adobe InDesign CS5.5"
set myagents to (name of properties of every asset of library "Agents.indl" as list)
end tell
set agentlist to ""
repeat with currentagent in myagents
set agentlist to agentlist & currentagent & ","
end repeat
set x to count agentlist
set agentlist to characters 1 thru (x - 1) of agentlist as string
my write_agents(agentlist)
on write_agents(this_list)
set the agent_log to ("/Volumes/Agents/agents.txt" as POSIX file)
try
set eof of agent_log to 0
open for access file the agent_log with write permission
write (this_list) to file the agent_log starting at eof
--set read_data to (read the_file as list) as text
close access file the agent_log
on error
try
close access file the agent_log
end try
end try
end write_agents
Instead of the Indesign tell at the top for testing we can use, the result is the same
set myagents to {"Lois Chase Johnson", "Tammy Newton", "Team Schmidt", "Tanya Kerr", "Terry Peterson", "Brenda Clark", "Deb Kahle", "Carol Dana", "Sheryl Burley & Cathy Reed", "Linda Ulin", "Dianna Erickson", "Dave Sharman", "Lori Tracey & Chuck Murphy", "Carolyn & Robert Dodds", "Jean Ryker", "Bryan Diehl", "Lois Scheck", "Nancy Rathke", "Patrick French", "Laura Halady", "Jennifer Felton", "Clarice Arakawa", "Holly Coburn", "Quint Boe", "Michaelle Barnard", "Paul Beck", "Kelly Johnson", "Doc Reiss", "Helga Filler", "Harriet Reyenga", "Thelma Durham", "Brooke Nelson", "Dick Pilling", "David Ramey", "Rebecca Jackson", "Tim Riley", "Pili Meyer", "Marc Thomsen", "Kathy Brown", "Jean Irvine", "Kathy Love", "Kimi Robertson", "Ed Sumpter", "Jo Cummins", "Kim Bower", "Mike Fuller", "Cathy Reed", "Joyce Underwood", "Daphne Eshom", "Kathy Brown", "Dave Ramey", "Mark DeRousie", "Tom Blore", "Paul Beck", "Kelly Johnson", "Alan Burwell", "Sheryl Burley", "Vivian Landvik", "Mark HcHugh", "Jim Newton", "Chuck Turner"}
What is in the text file?
Lois Chase Johnson,Tammy Newton,Team Schmidt,Tanya Kerr,Terry Peterson,Brenda Clark,Deb Kahle,Carol Dana,Sheryl Burley & Cathy Reed,Linda Ulin,Dianna Erickson,Dave Sharman,Lori Tracey & Chuck Murphy,Carolyn & Robert Dodds,Jean Ryker,Bryan Diehl,Lois Scheck,Nancy Rathke,Patrick French,Laura Halady,Jennifer Felton,Clarice Arakawa,Holly Coburn,Quint Boe,Michaelle Barnard,Paul Beck,Kelly Johnson,Doc Reiss,Helga Filler,Harriet Reyenga,Thelma Durham,Brooke Nelson,Dick Pilling,David Ramey,Rebecca Jackson,Tim Riley,Pili Meyer,Marc Thomsen,Kathy Brown,Jean Irvine,Kathy Love,Kimi Robertson,Ed Sumpter,Jo Cummins,Kim Bower,Mike Fuller,Cathy Reed,Joyce Underwood,Daphne Eshom,Kathy Brown,Dave Ramey,Mark DeRousie,Tom Blore,Paul Beck,Kelly Johnson,Alan Burwell,Sheryl Burley,Vivian Landvik,Mark HcHugh,Jim Newton,Chuck Turner �C�o�b�u�r�nutxt����Q�u�i�n�t� �B�o�eutxt���"�M�i�c�h�a�e�l�l�e� �B�a�r�n�a�r�dutxt����P�a�u�l� �B�e�c�kutxt����K�e�l�l�y� �J�o�h�n�s�o�nutxt����D�o�c� �R�e�i�s�sutxt����H�e�l�g�a� �F�i�l�l�e�rutxt����H�a�r�r�i�e�t� �R�e�y�e�n�g�autxt����T�h�e�l�m�a� �D�u�r�h�a�mutxt����B�r�o�o�k�e� �N�e�l�s�o�nutxt����D�i�c�k� �P�i�l�l�i�n�gutxt����D�a�v�i�d� �R�a�m�e�yutxt����R�e�b�e�c�c�a� �J�a�c�k�s�o�nutxt����T�i�m� �R�i�l�e�yutxt����P�i�l�i� �M�e�y�e�rutxt����M�a�r�c� �T�h�o�m�s�e�nutxt����K�a�t�h�y� �B�r�o�w�nutxt����J�e�a�n� �I�r�v�i�n�eutxt����K�a�t�h�y� �L�o�v�eutxt����K�i�m�i� �R�o�b�e�r�t�s�o�nutxt����E�d� �S�u�m�p�t�e�rutxt����J�o� �C�u�m�m�i�n�sutxt����K�i�m� �B�o�w�e�rutxt����M�i�k�e� �F�u�l�l�e�rutxt����C�a�t�h�y� �R�e�e�dutxt����J�o�y�c�e� �U�n�d�e�r�w�o�o�dutxt����D�a�p�h�n�e� �E�s�h�o�mutxt����K�a�t�h�y� �B�r�o�w�nutxt����D�a�v�e� �R�a�m�e�yutxt����M�a�r�k� �D�e�R�o�u�s�i�eutxt����T�o�m� �B�l�o�r�eutxt����P�a�u�l� �B�e�c�kutxt����K�e�l�l�y� �J�o�h�n�s�o�nutxt����A�l�a�n� �B�u�r�w�e�l�lutxt����S�h�e�r�y�l� �B�u�r�l�e�yutxt����V�i�v�i�a�n� �L�a�n�d�v�i�kutxt����M�a�r�k� �H�c�H�u�g�hutxt����J�i�m� �N�e�w�t�o�nutxt����C�h�u�c�k� �T�u�r�n�e�rutxt����
So it goes well for a while but at the end there are no commas but instead gobblygook which is unusable. Where have I gone wrong?
Not sure what exactly I changed, but it now works…..