Re: make a list with : choose from list ABC with prompt
Re: make a list with : choose from list ABC with prompt
- Subject: Re: make a list with : choose from list ABC with prompt
- From: has <email@hidden>
- Date: Fri, 20 May 2005 18:07:39 +0100
Clem'Sail wrote:
>i want use a script to make a list of choose with a list.
>this list it's composed to : nameoflist {"None", "Title 1", "Content of Title1", "Title 2", "Content of Title2", etc...}
>the list of choose work very fine, but when i choose in this list, the result are not in a list but it's a string and i can't use to detect wath title are choose to make a mail with all content of title choose.
Your code's pretty confused and you don't really explain what it's supposed to do, but I think this is roughly what you're trying to achieve:
on getAllKeys(keyValueList)
set res to {}
repeat with i from 1 to keyValueList's length by 2
set end of res to keyValueList's item i
end repeat
return res
end getKeys
on askUserSelection(optionsList)
set res to choose from list optionsList with prompt ¬
"Choose the transaction" default items {"None"} with multiple selections allowed
if res is false then return {}
return res
end askUserSelection
on getValuesForGivenKeys(keysList, keyValueList)
set res to {}
repeat with i from 1 to keyValueList's length by 2
if {keyValueList's item i} is in keysList then
set end of res to keyValueList's item (i + 1)
end if
end repeat
return res
end getValuesForKeys
set keyValueList to {"Title 1", "Content of Title1", "Title 2", "Content of Title2"} -- a list of form {"key 1", "value 1", "key 2", "value 2", ...}
set selectedList to askUserSelection(getAllKeys(keyValueList))
getValuesForGivenKeys(selectedList, keyValueList)
HTH
has
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden