Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ryandask8s

macrumors newbie
Original poster
Jul 15, 2008
5
0
Code:
--Script By Ryan
set temp to display dialog "What is you age?" default answer "" buttons {"Cancel", "Info", "That's my age"} default button 3
set answer to button returned of temp
if answer is equal to "info" then
	say "Age converter created by Ryan"
end if
set resultAge to text returned of temp
set Male_life to 72.95 - resultAge
set Female_life to 79.67 - resultAge
set ageMonths to resultAge * 12
set ageDays to resultAge * 365
set ageWeeks to ageDays / 7
set ageHours to ageWeeks * 168
set answer to button returned of temp
if answer is equal to "That's my age" then
	display dialog "Months: " & ageMonths
	display dialog "Days: " & ageDays
	display dialog "Weeks: " & ageWeeks
end if
set Gender_List to choose from list {"Male", "Female"} with prompt "What is you gender?"
if answer is equal to "Male" then
	display dialog "You are expected to live this many more years: " & Male_life
end if
if answer is equal to "Female" then
	display dialog "You are expected to live this many more years: " & Female_life
end if

It is fine up until after you choose your gender. Can someone please help me so it predicts your life expectancy? :p Also can someone make it so when you press info it loops back to
Code:
set temp to display dialog "What is you age?" default answer "" buttons {"Cancel", "Info", "That's my age"}

(I have no idea why I'm doing it i just started an hour ago so i just kept going)
 
Code:
set Gender_List to choose from list {"Male", "Female"} with prompt "What is you[color=red]r[/color] gender?"
if [color=blue]answer[/color] is equal to "Male" then
	display dialog "You are expected to live this many more years: " & Male_life
end if
You didn't set answer to the result of the user's choice from the list.

Todd
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.