将行set the text item delimiters of AppleScript to ", "
中的逗号和空格更改为return
。新的生产线(没有双关语意)是这样的:
set the text item delimiters of AppleScript to return
关于你的第二个问题试试这个:
set AppleScript's text item delimiters to ""
return text items 2 thru -2 of some_string
让我们把它放在一起!
set some_file to "Macintosh HD:Users:Zade:Library:Application Support:Notational Data:Words.txt" as alias
set the_text to read some_file as string
set the_lines to (every paragraph of the_text)
set this_line to some item of the_lines
if this_line is not "" then
set AppleScript's text item delimiters to ""
set this_line to (text items 2 thru -2 of this_line) --remove the quotes
set AppleScript's text item delimiters to space
set these_items to (every text item of this_code)
set the this_line to (item 1 of these_items & this_line)
set AppleScript's text item delimiters to ""
return this_line
end if
编辑:您不能返回空行停止程序,但你可以过滤出来,像这样......
if paragraph i of some_text is not "" then do_something()
这真棒,谢谢。如果在我的文本文件中存在非标准字符(如卷曲引号),则每隔一段时间它都会返回奇怪的符号。有没有简单的方法来过滤/修复这些问题? – Zade 2012-01-12 22:26:49
如果角色位于已经剪裁完的端点上,您可以复制这些角色并将它们添加到列表中,否则像删除所有不需要的角色的shell脚本可能就是要走的路。 – 2012-01-12 23:12:47