AppleScript 从列表中选择
AppleScript choose from list
非常简单的问题,但是如何从 "choose from List"
启动脚本
例如:
set issueList to {"1", "2", "2", "4"}
set selectedIssue to {choose from list issueList}
if selectedIssue is {"1"} then
display dialog "ok" buttons {"1"} default button 1
else if selectedIssue is {"Holds Charge"} then
-- do nothing
display dialog "ok" buttons {"2"} default button 1
else if selectedIssue is {"2"} then
-- do nothing
display dialog "ok" buttons {"3"} default button 1
else if selectedIssue is {"3"} then
-- do nothing
display dialog "ok" buttons {"4"} default button 1
end if
当我点击列表的一个元素时,我在这个脚本中期望的是什么,通知开始(或任何其他脚本)但我没有结果。
干杯
通知returns{{"1"}},而不是{"1"}。将您的代码更改为
if item 1 of selectedIssue is {"1"} then
等,它应该可以工作。
你好,我遇到了和你一样的问题,但我用这样的代码解决了它:
set mailList to {"One","Two","Three","Four"}
set mailType to choose from list mailList
if item 1 of mailType is "One" then
display dialog mailType
else if item 1 of mailType is "Two" then
display dialog mailType
else if item 1 of mailType is "Three" then
display dialog mailType
else if item 1 of mailType is "Four" then
display dialog mailType
end if
非常简单的问题,但是如何从 "choose from List"
启动脚本例如:
set issueList to {"1", "2", "2", "4"}
set selectedIssue to {choose from list issueList}
if selectedIssue is {"1"} then
display dialog "ok" buttons {"1"} default button 1
else if selectedIssue is {"Holds Charge"} then
-- do nothing
display dialog "ok" buttons {"2"} default button 1
else if selectedIssue is {"2"} then
-- do nothing
display dialog "ok" buttons {"3"} default button 1
else if selectedIssue is {"3"} then
-- do nothing
display dialog "ok" buttons {"4"} default button 1
end if
当我点击列表的一个元素时,我在这个脚本中期望的是什么,通知开始(或任何其他脚本)但我没有结果。
干杯
通知returns{{"1"}},而不是{"1"}。将您的代码更改为
if item 1 of selectedIssue is {"1"} then
等,它应该可以工作。
你好,我遇到了和你一样的问题,但我用这样的代码解决了它:
set mailList to {"One","Two","Three","Four"}
set mailType to choose from list mailList
if item 1 of mailType is "One" then
display dialog mailType
else if item 1 of mailType is "Two" then
display dialog mailType
else if item 1 of mailType is "Three" then
display dialog mailType
else if item 1 of mailType is "Four" then
display dialog mailType
end if