Trying to work out how to have the user enter a string of numbers which can then be used as a list.
display dialog "Please specify required page numbers separated by a comma" default answer "1, 2, 3"
set PageList to the text returned of result -- as list
repeat with aPage in PageList
display dialog aPage
end repeat
The script returns not only the numbers but ALL the text items. (commas and spaces as well).
How do I convert the text to list which contain just the numbers for use as a list further in the script.
Try something like this:
display dialog default answer "1, 2, 3"
set PageList to text returned of result
set prevTIDs to text item delimiters of AppleScript
set text item delimiters of AppleScript to ", "
set PageList to text items of PageList
set text item delimiters of AppleScript to prevTIDs
repeat with aPage in PageList
display dialog aPage
end repeat
Thanks Bruce !!
I suspected that delimiters are one way of achieving this. I was curious, whether there was a way to specify a list directly without the use of delimiters.
Matt.