Reputation: 1106
Very simple question but how to start a script from a "choose from List"
E.g :
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
what I expected in this script its when I click on a element of the list , a notification start (or any other script) but I have no result.
Cheers
Upvotes: 1
Views: 5000
Reputation: 23
Hello I got the same issue with yours, but I solved it with code like this:
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
Upvotes: 1
Reputation: 6699
The notification returns {{"1"}}, not {"1"}. Change your code to
if item 1 of selectedIssue is {"1"} then
etc and it should work.
Upvotes: 3