我有一个选择列表。无论您在列表中做出什么选择,都应确定下一个列表中可用的选择。我目前正在接收
错误“无法获得\“ \”的项目1。“来自“”
项目1的编号-1728似乎第一个列表中的set变量没有馈入If Else If语句。
set currentSupport to "" -- initialize the variable
set supportList to choose from list {"A", "B"} with prompt "Source:" default items {"A"}
set currentSupport to result
set currentPR to "" -- initialize the variable
if currentSupport is "A" then
set misrouteList to choose from list {"1", "2", "3", "4"} with title "Prepared Responses" with prompt "Reason:"
set currentPR to result
else if currentSupport is "B" then
set misrouteList to choose from list {"5", "6", "7", "8", "9", "10"} with title "Prepared Responses" with prompt "Reason:"
set currentPR to result
end if
set supportChoice to item 1 of currentSupport
set prChoice to item 1 of currentPR
答案 0 :(得分:0)
choose from list
或项目的列表(即使未启用false
,则 Cancel
返回with multiple selections
。
您必须在{strong> {1>}表达式之前
if - else
或没有冗余代码
set currentSupport to "" -- initialize the variable
set supportList to choose from list {"A", "B"} with prompt "Source:" default items {"A"}
if supportList is false then return
set currentSupport to item 1 of supportList
set currentPR to "" -- initialize the variable
if currentSupport is "A" then
set misrouteList to choose from list {"1", "2", "3", "4"} with title "Prepared Responses" with prompt "Reason:"
if misrouteList is false then return
set currentPR to item 1 of misrouteList
else if currentSupport is "B" then
set misrouteList to choose from list {"5", "6", "7", "8", "9", "10"} with title "Prepared Responses" with prompt "Reason:"
if misrouteList is false then return
set currentPR to item 1 of misrouteList
end if
set supportChoice to currentSupport
set prChoice to currentPR
或保留选择内容作为列表并检查set supportList to choose from list {"A", "B"} with prompt "Source:" default items {"A"}
if supportList is false then return
set currentSupport to item 1 of supportList
if currentSupport is "A" then
set responseList to {"1", "2", "3", "4"}
else -- there is only A or B
set responseList to {"5", "6", "7", "8", "9", "10"}
end if
set misrouteList to choose from list responseList with title "Prepared Responses" with prompt "Reason:"
if misrouteList is false then return
set currentPR to item 1 of misrouteList
set supportChoice to currentSupport
set prChoice to currentPR
{"A"}