找到更新解决方案如果感兴趣,请参阅帖子底部似乎很简单,并且对于大多数列表它都有效,但在某些时候它会搞砸。列表的数据来自 InDesign 中的资产,但这是我的最终结果,可以替换为测试 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
而不是我们可以使用顶部的 Indesign 指令进行测试,结果是相同的
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"}
文本文件中有什么?
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����
所以它运行了一段时间,但最后没有逗号,而是无法使用的 gobblygook。我哪里出错了?