AppleScript Programming/Sample Programs/Email Maker
This script will let the user input data, the data are then declared as variables. They are then formed together making a person's perfect email address. I have divided the code into sections. The full code is at the bottom of the page.
First, the welcoming:
display dialog "Welcome To Perfect Email"
Next, we declare variables for the text returned
set pet to text returned of (display dialog "Enter Pet Name" default answer "i.e Bailey" buttons {"OK"} default button 1) set dono to text returned of (display dialog "Enter Last Two Digits of your Birth Year" default answer "i.e 98 (*1998)" buttons {"OK"} default button 1) set prov to text returned of (display dialog " Email Service Provider" default answer "i.e @yahoo.com, @aol.com" buttons {"OK"} default button 1)
We set 3 variables : pet, dono, and prov
prov = provider
dono = last two digits of birth year
pet = pet name
We set them to the text returned of a display dialog with text input. Then we displayed all the variables (pet, dono, prov) together.
display dialog pet & dono & prov
Full Code:
<code> display dialog "Welcome To Perfect Email" set pet to text returned of (display dialog "Enter Pet Name" default answer "i.e Bailey" buttons {"OK"} default button 1) set dono to text returned of (display dialog "Enter Last Two Digits of your Birth Year" default answer "i.e 98 (*1998)" buttons {"OK"} default button 1) set prov to text returned of (display dialog " Email Service Provider" default answer "i.e @yahoo.com, @aol.com" buttons {"OK"} default button 1) display dialog pet & dono & prov </code>