如何 return 列表中的每个元素作为 AppleScript 中的新行?

How to return each element of a list as a new line in AppleScript?

我想 return 变量 additionalactions 作为段落分隔字符串,以便在 zsh 中很容易拆分。像这样,它被 returned 作为逗号分隔的字符串。

#!/bin/zsh

WER=("Option 1" "Option 2" "Option 3")    

read -r -d '' SELECTWER << EOF
set actions to the paragraphs of "$(printf '%s\n' "${WER[@]}")"
set additionalactions to choose from list actions with prompt "Additional Actions:" default items {"Multiple Instances"} with multiple selections allowed
return additionalactions
EOF

WER=$(osascript -e "$SELECTWER");

WER 输出 Option 2, Option 3。 (假设在对话框中选择了选项 2 和选项 3) WER 应该打印 Option 2\nOption3。然后我可以将各个行读入一个数组。

#!/bin/zsh

WER=("Option 1" "Option 2" "Option 3")    

osascript - "${(@)WER}" << EOF 
    on run argv
        set acts to choose from list argv with multiple selections allowed
        if acts is false then return ""
        set text item delimiters to linefeed
        return acts as string
    end run
EOF