Q: applescript: ask a user to input a several numbers in line
Hi there,
how can I ask in display dialog a several strings in one dialog window like this:
Input three letters in right column
window show me asks me to input
first letter [ ]
second letter [ ]
third letter [ ]
MacBook Pro, OS X El Capitan (10.11.2)
Posted on Aug 22, 2016 10:18 AM
AppleScript's language implementation of display dialog does not offer multiple inputs, or formatting. However, you can separate your inputs with a delimiter, and then place those items into a list, from which you can reference those items.
Here is an demonstration AppleScript. You enter text (as an example) in this format: A1,B1,C1
use scripting additions
set msg to "Input three letters for each of first letter, second letter, and third letter. Separate your responses by a comma (e.g. aaa,bbb,ccc)"
set delimAnswer to text returned of (display dialog msg default answer "")
set {TID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ","}
set dialogList to text items of delimAnswer
set {TID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
display dialog "Items are: " & return & (items of dialogList) & return & "Item 1: " & (item 1 of dialogList) as text
set AppleScript's text item delimiters to TID
return
Posted on Aug 22, 2016 10:58 AM