Readers like you help support MUO. When you make a purchase using links on our site, we may earn an affiliate commission. Read More.

I am trying to use the textual response from an AppleScript dialogue in a shell script command within Applescript. My script at the moment looks like this, where NAME is the response from the dialogue:

set dd to display dialog "What is your name?" default answer " "

do shell script "say Welcome NAME"

 

sojourner
2012-09-28 02:19:44
set dd to text returned of (display dialog “What is your name?” default answer ” ”)do shell script “say Welcome " & dd
MAKEUSEOF VIDEO OF THE DAY
SCROLL TO CONTINUE WITH CONTENT
Mike
2012-09-23 07:46:03
The first things that come to mind(1) your line reads "set dd to" which means you do net SET the variable NAME you try to output in the shell part of the script(2) "dd" is an actual shell command, you should never use such "conflicting" names when your AppleScript at some point goes into a shell command ~ it's asking for trouble.(3) in a shell script variables have to be stated outside the quotes so the line would have to be something like: do shell script "say 'Welcome ' & NAME & '!'"